Skip to content

Commit

Permalink
Fix example formatting (#803)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefano-ottolenghi committed Nov 29, 2023
1 parent 534305a commit c325525
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions modules/ROOT/pages/values-and-types/lists.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
[[cypher-lists]]
= Lists

Cypher includes comprehensive support for lists.
This section first describes lists in general, and then discusses how to use list comprehension and pattern comprehension in lists.
Cypher includes comprehensive support for lists.
This section first describes lists in general, and then discusses how to use list comprehension and pattern comprehension in lists.

[NOTE]
====
Expand Down Expand Up @@ -56,10 +56,10 @@ For example:

.Query
[source, cypher]
---
----
WITH [5,1,7] AS list
RETURN list[2]
---
----

.Result
[role="queryresult",options="header,footer",cols="1*<m"]
Expand All @@ -69,7 +69,7 @@ RETURN list[2]
1+d|Rows: 1
|===

=== List range and size
=== List range and size

The below examples use the xref::functions/list.adoc#functions-range[`range`] function to create lists.
This function returns a list containing all numbers between given start and end numbers.
Expand Down Expand Up @@ -106,7 +106,7 @@ RETURN range(0, 10)[-3] AS element
|===

Finally, it is possible to use ranges inside the brackets to return ranges of the list.
The list range operator (`[]`) is inclusive of the first value, but exclusive of the last value.
The list range operator (`[]`) is inclusive of the first value, but exclusive of the last value.

.Query
[source, cypher]
Expand Down Expand Up @@ -267,10 +267,10 @@ RETURN [(keanu)-->(b:Movie) WHERE b.title CONTAINS 'Matrix' | b.released] AS yea

The whole predicate, including the `WHERE` keyword, is optional and may be omitted.

==== Storing lists as properties
==== Storing lists as properties

It is possible to store homogenous lists of simple values as properties.
For example, the following query creates a list from the `title` properties of the `Movie` nodes connected to `Keanu Reeves`.
It is possible to store homogenous lists of simple values as properties.
For example, the following query creates a list from the `title` properties of the `Movie` nodes connected to `Keanu Reeves`.
It then sets that list as a `resume` property on `Keanu Reeves`.

.Query
Expand All @@ -291,8 +291,8 @@ RETURN keanu.resume
|===

It is not, however, possible to store heterogeneous lists as properties.
For example, the following query, which tries to set a list including both the `title` and the `released` properties as the `resume` property of `Keanu Reeves` will fail.
This is because the `title` property values are stored as strings, while the `released` property values are stored as integers.
For example, the following query, which tries to set a list including both the `title` and the `released` properties as the `resume` property of `Keanu Reeves` will fail.
This is because the `title` property values are stored as strings, while the `released` property values are stored as integers.

.Query
[source, cypher, role=test-fail]
Expand Down

0 comments on commit c325525

Please sign in to comment.