break
Exits the innermost flow-control block. Must be used within a flow-control block.
Used in the following format:
break
Examples
i = 0 # i: loop iter var
while true # don’t conditionalize before iterations
{
... # do something
i = i + 1 # i = i+1
break # exit the while loop immediately.
}
continue
Continues at the top on the innermost flow-control block. Must be used within a flow-control block.
Used in the following format:
continue
Examples
i = 0 # i: loop iter var
while i < 100
{
i = i + 1
if ... # check something
then
continue
else
... # do something else
}
while
Loops as long as the conditional expression is satisfied. The conditional expression is evaluated before each iteration. In each iteration, every statement is executed, and every expression is sequentially evaluated. Usually, the conditional expression contains a reference to a dynamic variable that is updated within the loop. If the conditional expression evaluates to the null value, iteration stops.
Used in the following format, where cond-expr
must be a boolean valued expression, expr
may be any expression and stmts
may be any procedural statement:
while cond-expr {expr|stmt}*
Examples
i = 0 # i: loop iter var
while i < $num-iters # loop $num-iters times
{
...
i = i + 1
# i = i+1
}