WHILE...WEND

Function

WHILE...WEND executes a set of statements if a condition is true.

Syntax

WHILE numeric expression
.
.
.
statements
.
.
.
WEND

'numeric expression' is evaluated true or false; if the expression is true the statements following are executed. If false, the statement after WEND is executed. The loops may be nested; each WEND associated with the most recent WHILE.

Examples

 10 FOR Q=1 TO 10
 20 B(Q)=Q
 30 NEXT
110 WHILE A< 11
120 FOR I = 1 TO 10
130 PRINT B(I);
140 NEXT
150 PRINT A:A = A+1
160 WEND

The matrix B is printed as long as the A parameter is less than 11.

Remarks

Each time WEND is encountered the expression is reevaluated. The same precautions should be exercised in jumping out of this loop as with FOR....NEXT loops.

WHILE cannot be used with a string expression. The statements WHILE and WEND must be on separate lines and no other statements must be on those lines.