Boolean, numeric, and string literals
This page describes the literal forms of numerical (INTEGER and FLOAT), STRING, and BOOLEAN values in expressions.
| Expressions containing unsanitized user input may make your application vulnerable to Cypher® injection. Consider using parameters instead. For more information, see Neo4j Knowledge Base → Protecting against Cypher Injection. |
Boolean
Boolean literals represent BOOLEAN values.
A boolean literal may be written as:
-
The literal
true -
The literal
false
Numerical
Numerical literals can represent INTEGER or FLOAT values.
A numerical literal may be written as:
-
A decimal
INTEGERliteral:13,-40000 -
A hexadecimal
INTEGERliteral (prefix0x):0x13af,0xFC3A9,-0x66eff -
An octal
INTEGERliteral (prefix0o):0o1372,-0o5671
-
A
FLOATliteral in common notation:3.14 -
A
FLOATliteral in scientific notation:6.022E23,1e-9 -
Literals for special
FLOATvalues:Inf,Infinity,NaN
Any numeric literal may contain an underscore _ between digits.
There may be an underscore between the 0x or 0o and the digits for hexadecimal and octal literals.
For example: 1_000_000, 0x_FC3A9, and 0o_1372.
|
String
String literals represent STRING values.
They are written using single(') or double quotes (") and may contain escape sequences using a backslash (\).
A string literal may be written as:
-
A
STRINGquoted with single quotes:'Hello, 42' -
A
STRINGquoted with double quotes:"Hello, 42" -
A
STRINGwith whitespace:' hello ' -
A
STRINGwith escape sequences:'Line 1\nLine 2','Tab\tseparated' -
A
STRINGcontaining Unicode characters:'그래프는 어디에나 있다' -
A
STRINGusing a Unicode code point:'Name: \u004Aohn'(produces'Name: John')