Executes a series of statements as long as a given condition is true.
If condition is True
, all statements in statements are executed until the Wend
statement is encountered. Control then returns to the While
statement and condition is again checked. If condition is still True
, the process is repeated. If it is not True
, execution resumes with the statement following the Wend
The following example illustrates use of the While...Wend
Counter = 0 ' Initialize variable.
While Counter < 20 ' Test value of Counter.
Counter = Counter + 1 ' Increment Counter.
Wend ' End While loop when Counter > 19.
statement provides a more structured and flexible way to perform looping.