Statements
Every statement is an expression, optionally followed by a modifier, and terminated with a semicolon. The semicolon may be omitted if the statement is the final one in a block.
Execution of expressions can depend on other expressions using one of the modifiers if, unless, while, or until, for example:
expr1ifexpr2 ; expr1untilexpr2 ;
The logical operators | |, & &, or ? : also allow conditional execution:
expr1 | | expr2 ; expr1 ? expr2 : expr3 ;
Statements can be combined to form a block when enclosed in { }. block s may be used to control flow:
if(expr) block [ [elsif(expr) block...]elseblock ]unless (expr) block [elseblock ][ label: ]
while(expr) block [continueblock ][ label: ]
until(expr) block [continueblock ][ label: ]
for( [ expr ] ; [ expr ] ; [ expr ] ) block[ label: ]
foreachvar(dagger) (list ) block[ label: ] block [
continueblock ]
Program flow can be controlled with:
gotolabel- Continue execution at the specified label.
last[ label ]- Immediately exits the loop in question. Skips continue block.
next[ label ]- Starts the next iteration of the loop.
redo[ label ]- Restarts the loop block without evaluating the conditional again.
Special forms are:
doblockwhileexpr ;doblockuntilexpr ;
which are guaranteed to perform block once before testing expr, and
do block
which effectively turns block into an expression.