While...Wend


Statement While


Executes an enclosed block of statements as long as a given condition is true.


Syntax While condition

statements

Wend


If condition is true (non zero), statements are executed until the Wend statement is encountered. Control then returns to the While statement and condition is again checked. This process repeats until the condition is made false (0), then execution continues on the line after the Wend.


Break can be used to exit the loop early, Continue is used to force an immediate re-evaluation of condition.


Remarks


See Also:

Break Continue


Example Script


NUMBER i


i = 0

WHILE i < 100 ' Condition will terminate when i == 100

i++

IF i == 50 THEN

PRINT "I is 50"

ENDIF

IF i == 70 THEN

PRINT "70 is close enough"

BREAK ' Will break out of the loop early.

ENDIF

WEND


Script Output


I is 50

70 is close enough