A token that represents a new line.
A literal is an expression consisting of a single token, rather than a sequence of tokens, that immediately and directly denotes the value it evaluates to, rather than referring to it by name or some other evaluation rule. A literal is a form of constant expression, so is evaluated (primarily) at compile time.
|String||ASCII subset||Quote & ASCII|
* All number literals allow
_ as a visual separator:
Any ASCII character between
A string literal is a sequence of any characters that are in the set of printable ASCII characters as well as a set of defined escape sequences.
Line breaks are allowed in string literals.
( DEC_LITERAL | BIN_LITERAL | OCT_LITERAL | HEX_LITERAL )
_)* BIN_DIGIT (BIN_DIGIT|
_)* OCT_DIGIT (OCT_DIGIT|
_)* HEX_DIGIT (HEX_DIGIT|
BIN_DIGIT : [
OCT_DIGIT : [
DEC_DIGIT : [
HEX_DIGIT : [
An integer literal has one of four forms:
- A decimal literal starts with a decimal digit and continues with any mixture of decimal digits and underscores.
- A hex literal starts with the character sequence
0x) and continues as any mixture (with at least one digit) of hex digits and underscores.
- An octal literal starts with the character sequence
0o) and continues as any mixture (with at least one digit) of octal digits and underscores.
- A binary literal starts with the character sequence
0b) and continues as any mixture (with at least one digit) of binary digits and underscores.
Examples of integer literals of various forms:
123 # type u256 0xff # type u256 0o70 # type u256 0b1111_1111_1001_0000 # type u256 0b1111_1111_1001_0000i64 # type u256