While...Wend

Last Modified: 1/3/2021

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

Arguments

NameTypeRequiredDescription
Condition Expression Yes The condition when you want the loop to end.

Example

Syntax:
 
  While <Condition>]/em>
    [Statements]
    [Continue]
    [Statements]
  Loop Wend
    While x < 5
        x++
        Print x
    Wend

Remarks

You would use a While...Wend block when you want to repeat a block of code repeatedly, until the Condition is met.

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

See Also

Do...Loop, Continue, Exit, For...Next