3.0 KiB
3.0 KiB
Literals Syntax
{{#include ../links.md}}
Type | Literal syntax |
---|---|
INT |
decimal: 42 , -123 , 0 hex: 0x????.. binary: 0b????.. octal: 0o????.. |
FLOAT ,[ Decimal ][rust_decimal] (requires [no_float ]+[decimal ]) |
42.0 , -123.456 , 123. , 123.456e-10 |
[Ranges] in [switch ] cases |
-10..10 (exclusive), 0..=50 (inclusive) |
Normal [string] | "... \x?? \u???? \U???????? ..." |
[String] with continuation | "this is the first line\ second line\ the third line" |
Multi-line literal [string] | `this is the first line second line the last line` |
Multi-line literal [string] with interpolation | `this is the first field: ${obj.field1} second field: {obj.field2} the last field: ${obj.field3}` |
[Character] | single: '?' ASCII hex: '\x??' Unicode: '\u????' , '\U????????' |
[Array ] |
[ ???, ???, ??? ] |
[Object map] | #{ a: ???, b: ???, c: ???, "def": ??? } |
Boolean true | true |
Boolean false | false |
Nothing /null /nil /void /Unit |
() |