While...Wend
WHILE condition
- [statements]
- [statements]
WEND
Description
WHILE...WEND repeats a group of statements while a given condition is TRUE. The required component, condition, is any valid expression that evaluates to TRUE or FALSE. The optional component, statements, are executed during each iteration of the loop. WHILE...WEND statements can be nested, and any WEND statements in a nested loop transfer execution to one level above the loop where the WEND occurs.
Example
REM WHILE...WEND Example 'WHILE...WEND repeats a group of statements DIM Counter Counter = 1 WHILE Counter < 5 PRINT "Counter = " & Counter Counter = Counter + 1 WEND
Output
Counter = 1 Counter = 2 Counter = 3 Counter = 4
Related Items