Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add annotation to some examples of list clause #2400

Merged
merged 1 commit into from
Dec 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs-2.0-zh/3.ngql-guide/5.operators/8.list.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,31 @@
## 示例

```ngql
# 返回连接后的列表。
nebula> YIELD [1,2,3,4,5]+[6,7] AS myList;
+-----------------------+
| myList |
+-----------------------+
| [1, 2, 3, 4, 5, 6, 7] |
+-----------------------+

# 返回列表中的元素数量。
nebula> RETURN size([NULL, 1, 2]);
+------------------+
| size([NULL,1,2]) |
+------------------+
| 3 |
+------------------+

# 返回 NULL 是否存在列表中。
nebula> RETURN NULL IN [NULL, 1];
+--------------------+
| (NULL IN [NULL,1]) |
+--------------------+
| __NULL__ |
+--------------------+

# 返回在列表[2, 3, 4, 5]中存在,且也在列表[2, 3, 8]中存在的元素,并拆分显示。
nebula> WITH [2, 3, 4, 5] AS numberlist \
UNWIND numberlist AS number \
WITH number \
Expand All @@ -44,6 +48,7 @@ nebula> WITH [2, 3, 4, 5] AS numberlist \
| 3 |
+--------+

# 返回列表中下标为 1 的元素。
nebula> WITH ['Anne', 'John', 'Bill', 'Diane', 'Eve'] AS names RETURN names[1] AS result;
+--------+
| result |
Expand Down