Do Statement

Syntax

Do
    statements
Loop
-or-
Do {Until|While} condexpr
    statements
Loop
-or-
Do
    statements
Loop {Until|While} condexpr

Group

Flow Control

Description

Form 1: Do statements forever. The loop can be exited by using Exit or Goto.

Form 2: Check for loop termination before executing the loop the first time.

Form 3: Execute the loop once and then check for loop termination.

Loop Termination

Example


Sub Main
    I = 2
    Do
        I = I*2
    Loop Until I > 10
    Debug.Print I ' 16
End Sub

See also

For, For Each, Exit Do, While