Literals
Supported literals in k# are: strings, characters, numbers.
String
"Single line"
"""
Multi Line
String
"""
Character
'a'
note
k# uses UTF-8 for character and strings
Escape characters
\t | tab |
\' | ' |
\" | " |
\r | carriage return |
\\ | \ |
\n | new line |
\f | form feed |
\b | back space |
k# also supports unicode escape characters \uxxxx that represent a hexadecimal value from \u0000 to \uFFFF
Numbers
Integers
1 100 -50
Decimals
1.5 0.4 .3 -45.0 1e10
Thousands separator
k# allows to use _ as thousand separator
1_000_000
Expressing numbers in different bases
- binary
0b1001_0001
- hexadecimal
0xFF00FF
- Octal
0o1236
Collections
Lists
[1, 2, 3]
Maps
{"key": value, "key": value}
Set
#[1, 2, 4, 5]
Tuples
They are expressions followed by ,
1, 2
With list and sets you must surround the tuple with parenthesis
[(1, 2), (3, 4)]