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

comments #553

Merged
merged 2 commits into from
Jul 13, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
46 changes: 46 additions & 0 deletions docs-2.0/3.ngql-guide/1.nGQL-overview/comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Comments

This topic will describe the comments in nGQL.

## Legacy version compatibility

* In Nebula Graph 1.0, four comment styles: `#`, `--`, `//`, `/* */`.
izhuxiaoqing marked this conversation as resolved.
Show resolved Hide resolved
* In Nebula Graph 2.0, `--` represents [an edge pattern](../../3.ngql-guide/1.nGQL-overview/3.graph-patterns.md) and cannot be used as comments.

## Examples

```ngql
nebula> # Do nothing in this line
nebula> RETURN 1+1; # This comment continues to the end of this line.
nebula> RETURN 1+1; // This comment continues to the end of this line.
nebula> RETURN 1 /* This is an in-line comment. */ + 1 == 2;
nebula> RETURN 11 + \
/* Multi-line comment. \
Use a backslash as a line break. \
*/ 12;
```

In nGQL statement, the backslash `\` in a line indicates a line break.

## OpenCypher compatibility

* In nGQL, you must add a `\` at the end of every line, even in multi-line comments `/* */`.
* In openCypher, there is no need to use a `\` as a line break.

```openCypher
/* openCypher style:
The following comment
spans more than
one line */
MATCH (n:label)
RETURN n;
```

```ngql
/* nGQL style: \
The following comment \
spans more than \
one line */ \
MATCH (n:tag) \
RETURN n;
```
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ nav:
- nGQL overview:
- Overview: 3.ngql-guide/1.nGQL-overview/1.overview.md
- Graph patterns: 3.ngql-guide/1.nGQL-overview/3.graph-patterns.md
- Comments: 3.ngql-guide/1.nGQL-overview/comments.md
- Data types:
- Numeric: 3.ngql-guide/3.data-types/1.numeric.md
- Boolean: 3.ngql-guide/3.data-types/2.boolean.md
Expand Down