Literal values
Boolean
To create a boolean value there are just the usual two keywords:
truefalse
Integer
Integers can be created via:
Decimals, e.g.
1234Hexadecimals with a
0xprefix, e.g0x12abcdOctal numbers with a
0oprefix, e.g0o1234Binary numbers with a
0bprefix, e.g.0b010111
To improve readability of large numbers an _ can be added between any digit:
e.g. one million:
1_000_000Some readable hex:
0x1111_ffffSome binary:
0b1111_0000_0101_1010
Float
Floating point numbers can be created via:
Decimals, e.g.
12.34Exponential/scientific notation, e.g.
1.234e-5
Strings
String values can be created using double quotes, e.g.
"Hello world"
Inside a string the following escape sequences are allowed:
\\to insert a backslash\"to insert a double-quote (without terminating the string itself)\na line feed\ra carriage return\ta tabulator
String interpolation
In addition to static strings, c-sharp like string interpolation (i.e. strings with placeholders) are supported by starting with a $", e.g.
const a = 1234
const b = "Hello"
$"{b} world {a}"
will produce the string Hello world 1234
Like in c-sharp, the placeholders can formatted via the {<interpolationExpression>[,<alignment>][:<formatString>]} pattern, e.g.
const c = 12.34
$"a fixed point {c,10:N4}"
will produce the string a fixed point 12.3400
Refer to https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated for a detailed description of the various formatting options.