HaxeDoc2

(やまだぃちぅ) #1

6 expression;
7 }


Thereturnleaves local functionf2, but notf1, meaningexpressionis still evaluated.
Ifreturnis used without a value expression, the typer ensures that the return type of the
function it returns from is ofVoid. If it has a value expression, the typer unifies (3.5) its type with
the return type (explicitly given or inferred by previousreturnexpressions) of the function it
returns from.

5.20 break


Thebreakkeyword leaves the control flow of the innermost loop (fororwhile) it is declared
in, stopping further iterations:

1 while(true){
2 expression1;
3 if (condition) break;
4 expression2;
5 }


Here,expression1is evaluated for each iteration, but as soon asconditionholds,expression2
is not evaluated anymore.
The typer ensures that it appears only within a loop. Thebreakkeyword inswitchcases
(5.17) is not supported in Haxe.

5.21 continue


Thecontinuekeyword ends the current iteration of the innermost loop (fororwhile) it is
declared in, causing the loop condition to be checked for the next iteration:

1 while(true){
2 expression1;
3 if(condition) continue;
4 expression2;
5 }


Here,expression1is evaluated for each iteration, but ifconditionholds,expression2
is not evaluated for the current iteration. Unlikebreak, iterations continue.
The typer ensures that it appears only within a loop.

5.22 throw


Haxe allows throwing any kind of value using itsthrowsyntax:

1 throw expr


A value which is thrown like this can be caught bycatchblocks (5.18). If no such block
catches it, the behavior is target-dependent.
Free download pdf