4 ...
5 exprN;
6 }
The value and by extension the type of a block-expression is equal to the value and the type of
the last sub-expression.
Blocks can contain local variables declared byvarexpression (5.10), as well as local func-
tions declared byfunctionexpressions (5.11). These are available within the block and within
sub-blocks, but not outside the block. Also, they are available only after their declaration. The
following example usesvar, but the same rules apply tofunctionusage:
1 {
2 a; // error, a is not declaredyet
3 var a = 1; // declare a
4 a; // ok, a was declared
5 {
6 a; // ok, a is availablein sub-blocks
7 }
8 // ok, a is still available after
9 // sub-blocks
10 a;
11 }
12 a; // error, a is not available outside
At runtime, blocks are evaluated from top to bottom. Control flow (e.g. exceptions (5.18) or
return expressions (5.19)) may leave a block before all expressions are evaluated.
5.2 Constants...........................................
The Haxe syntax supports the following constants:
Int:An integer (2.1.1), such as 0 , 1 , 97121 ,-12,0xFF0000.
Float:A floating point number (2.1.1), such as0.0,1.,.3,-93.2.
String:A string of characters (10.1), such as"","foo",’’,’bar’.
true,false:A boolean (2.1.4) value.
null: The null value.
Furthermore, the internal syntax structure treats identifiers ( 5 ) as constants, which may be
relevant when working with macros ( 9 ).
5.3 Binary Operators
5.4 Unary Operators
5.5 Array Declaration......................................
Arrays are initialized by enclosing comma,separated values in brackets[]. A plain[]rep-
resents the empty array, whereas[1, 2, 3]initializes an array with three elements 1 , 2 and
3.