While...Wend Statements
Language Items List
Definition:
Executes a statement block in a loop as long as a given condition exists.
Syntax:
While condition
[statementblock]
Wend
Syntax Description
While Begins the While...Wend loop control structure.
condition Any numeric or string expression that evaluates true (nonzero) or false (0).
statementblock Any number of Phoenix statements on one or more lines.
Wend Ends the While...Wend loop. .
Details:
The While...Wend Statements are similar to the Do Until...Loop Statements and
have been retained for compatibility to older versions of BASIC. The Do
Until...Loop provides more structure and flexibility when performing loops and should
be used in place of While...Wend whenever possible.
In a While...Wend loop, the condition is tested first. If the condition is
true, the statement block is executed until Wend is reached, then condition is rechecked. If the condition remains true, the process is repeated. If the
condition is false, the statement block is not executed and control moves to
the statement immediately following Wend.
While...Wend loops can be nested to any level. Each Wend must match the most
recent While, and vice-versa. If it cannot find a match, a program exception is
thrown.
The Exit do statement can be used to prematurely exit a While...Wend loop.
See Also:
Do...Loop Statements