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


WHILE numeric expression

'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.


 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.


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.