Gri Commands
|
12.49: The `
|
`while .test.|{rpn ...}' |
Perform statements in loop while the value of `.test.
' or the RPN
expression is nonzero. The end of the loop designated by a line
containing the words `end while
'. The value `.test.
' may be
an rpn expression. To leave the loop prematurely, use a `break
'
statement. Upon encountering a `break
' statement, Gri jumps to the
line immediately following the loop. If the `-chatty
' option is
nonzero, a notification is printed every 1000 passes through the loop,
as a debugging measure to catch unintended infinite loops.
Examples:
while 1 show "This loops forever. Need to 'break'" end while |
while 1 read .x. .y. if ..eof.. break end if draw symbol bullet at .x. .y. end while |
.i.
' as they range 0, 1,
..., 9. After exiting from the loop, `.i.
' will equal 10. Be
careful to use the correct rpn greater-than test to avoid an
infinite loop.
.i. = 0 while {rpn .i. 10 >} show .i. .i. += 1 end while |