Chapter 5
Expressions
Expressions in Haxe define what a programdoes. Most expressions are found in the body of a
method (4.3), where they are combined to express what that method should do. This section
explains the different kinds of expressions. Some definitions help here:
Definition: Name
A general name may refer to
- a type,
- a local variable,
- a local function or
- a field.
Definition: Identifier
Haxe identifiers start with an underscore_, a dollar$, a lower-case charactera-zor an
upper-case characterA-Z. After that, any combination and number of_,A-Z,a-zand0-9
may follow.
Further limitations follow from the usage context, which are checked upon typing:
- Type names must start with an upper-case letterA-Zor an underscore_.
- Leading dollars are not allowed for any kind of name ( 5 ) (dollar-names are mostly used
for macro reification (9.3)).
5.1 Blocks.............................................
A block in Haxe starts with an opening curly brace{and ends with a closing curly brace}.A
block may contain several expressions, each of which is followed by a semicolon;. The general
syntax is thus:
1 {
2 expr1;
3 expr2;