Do...Loop

Last Modified: 1/2/2021

Creates a loop that ends when a condition is met or the Exit command is used.

Arguments

NameTypeRequiredDescription
Condition Expression No Required when using While or Until.

Example

Syntax:
 
  Do [While <Condition>]
    [Statements]
    [Continue]
    [Statements]
  Loop [Until | While <Condition>]
    Do
        x++
        Print x
    Loop Until x = 5

Remarks

You would use a Do...Loop block when you want to repeat a block of code repeatedly, until the Condition is met. If no Condition is specified, the only way to break out of the loop is with an Exit command.

If you want to loop your code a specific number of times, consider using a For...Next loop instead.

See Also

Continue, Exit, For...Next, While...Wend