FutureBasic Logo

<<    Index    >> FutureBasic

while   statement



Syntax
while expr
[statementBlock]
wend

Description
The while statement marks the beginning of a "while-loop," which must end with a wend statement. statementBlock consists of zero or more executable statements, possibly including other while-loops. When a while statement is encountered, FutureBasic evaluates expr. If expr is nonzero, FutureBasic executes the statements in statementBlock; otherwise it jumps down to the first statement following wend.
If the statementBlock statements are executed, the process is repeated; expr is evaluated again, and if it's still nonzero, the statementBlock statements are executed again. This loop continues until expr becomes zero, at which point the program exits the loop and jumps down to the first statement following wend.
Typically, expr is an expression involving logical operators, which is evalutated either as _zTrue (-1) or as _false (0). See the If statement for more information about expr.
Note that if expr is zero the first time it's evaluated, the statements in statementBlock are not executed at all. do...until is an alternative loop structure that executes statementBlock at least once.

See also
for...next; do...until; If; break; continue