5.2 Literals

Literals are ways to construct values for many Haxe core types using reserved syntax. The following table summarizes the literals available in Haxe:

ExampleTypeNote
42, 0xFF42Intinteger constant
0.32, 3., 2.1e5Floatfloating-point decimal constant
true, falseBoolboolean constant
~/haxe/giERegregular expression
nullTnull value for any nullable type
"XXX", 'XXX'Stringstring literal
"X".code, 'X'.codeIntUnicode character codepoint
[1, 2, 3], []Array<T>array literal
["a" => 1], []Map<T, U>map literal
{foo: true}, {}Tanonymous structure literal
1...3IntIteratorrange