Literals are ways to construct values for many Haxe core types using reserved syntax. The following table summarizes the literals available in Haxe:
Example | Type | Note |
---|---|---|
42 , 0xFF42 | Int | integer constant |
0.32 , 3. , 2.1e5 | Float | floating-point decimal constant |
true , false | Bool | boolean constant |
~/haxe/gi | EReg | regular expression |
null | T | null value for any nullable type |
"XXX" , 'XXX' | String | string literal |
"X".code , 'X'.code | Int | Unicode character codepoint |
[1, 2, 3] , [] | Array<T> | array literal |
["a" => 1] , [] | Map<T, U> | map literal |
{foo: true} , {} | T | anonymous structure literal |
1...3 | IntIterator | range |