Do...Loop
Previous  Next

Description: Creates a loop that ends when a condition is met or an Exit command is executed

     Syntax:
     
Do [While <Condition>]
        <Code>
Loop [<ConditionType> <Condition>]

Part
Description
<Condition>
Optional. This is an expression that returns true or false.
<ConditionType>
Optional. This is can either be While (loops while the condition is true) or Until (loops until the condition is true).

Notes: If a condition isn't specified, the only way to exit the loop is with the Exit command.
Example:

        Do
                x++
                If x = 10 Then Exit Do
        Loop

        x = 0

        Do While x < 10
                x++
        Loop

        x = 0

        Do
                x++
        Loop Until x = 10