<< Click to Display Table of Contents >> Do ... Loop (statement) |
Do [{While|Until} Condition]
[Statements]
[Exit Do]
[Statements]
Loop
Or:
Do
[Statements]
[Exit Do]
[Statements]
Loop [{While|Until} Condition]
Executes a group of statements repeatedly as long as a condition is true (Do ... While) or until a condition becomes true (Do ... Until). See also the section Flow control.
See also: While Wend, section Flow control
Example:
Sub Main
Dim Value, Msg
Do
Value = InputBox("Enter a number between 5 and 10.")
If Value >= 5 And Value <= 10 Then
Exit Do ' Number is OK -> Exit
Else
Beep ' Number is not OK -> try once more
End If
Loop
End Sub