|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
(This message will disappear, once this node revised.)
Two looping constructs are provided:
The syntax of a while loop is:
while cond stmt
Newline after cond is obligatory.
do stmt while cond
do...while loop differs from its
counterpart in that its stmt is executed at least once.
The looping constructs can be nested to any depth.
Two special statements are provided for branching within loop
constructs. These are
Break statement stops the execution of the current
loop statement and passes control to the statement immediately
while $x < 10 begin if $x < $y break … x = $x + 1 end print "OK\n"
In the example above, execution of
break statement passes
Break may also take an argument: a literal number representing
the number of nested loop statements to break from. For example, the
break statement in the sample code below will exit from the
while $y < 10 begin while $x < 10 begin if $x < $y break 2 … x = $x + 1 end … y = $y + 1 end print "OK\n"
Continue statement passes control to the condition of the
current looping construct. When used with a numeric argument, the
latter specifies the number of the nesting looping construct to
pass control to (as with
break, the innermost loop is
considered to have number 1, so
continue is equivalent
This document was generated by Sergey Poznyakoff on December, 6 2008 using texi2html 1.78.