This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!
Do...Loop Statement Example
This example shows how
Do...Loop statements can be used. The inner
Do...Loop statement loops 10 times, sets the value of the flag to
False, and exits prematurely using the
Exit Do statement. The outer loop exits immediately upon checking the value of the flag.
Dim Check, Counter
Check = True: Counter = 0 ' Initialize variables.
Do
' Outer loop.
Do While
Counter < 20 ' Inner loop.
Counter = Counter + 1 ' Increment Counter.
If Counter = 10 Then ' If condition is True.
Check = False ' Set value of flag to False.
Exit Do
' Exit inner loop.
End If
Loop
Loop Until
Check = False ' Exit outer loop immediately.