Syntax
Repeats a block as long as a condition is true. The condition is tested before each pass, so the body can run zero times.
WHILE <condition>
<statements>
ENDWHILE
END WHILE
WENDAlso written : ENDWHILE, WEND, END WHILE
Parts
| <condition> | Any expression, tested before each pass. 0, an empty string, FALSE and NULL are false. |
|---|---|
| <statements> | The body of the loop. |
Good to know
ENDWHILE,END WHILEandWENDall close the loop.DO WHILE … LOOPdoes not exist:DO … LOOPis the frame loop. WriteWHILE … ENDWHILE.- In a program with no
DOloop and noENDon its own line, a Sync() inside a WHILE does not wait for the next frame. A "wait for a click" loop then freezes the tab. Add anENDline to the program.
Example
n = 1WHILE n < 100 n = n * 2ENDWHILEConsole(Str(n)) ' 128WHILE n > 500 Console("never shown")WENDIn the manual : Control flow