Continue


Skips the rest of the current loop iteration and begins a new one. Valid inside any kind of loop.

Continue

The Continue statement applies to the innermost loop in which it is enclosed. It behaves the same as reaching the loop's closing brace:

  1. It increases A_Index by 1.
  2. It skips the rest of the loop's body.
  3. The loop's condition (if it has one) is checked to see if it is satisified. If so, a new iteration begins; otherwise the loop ends.

The use of Break and Continue are encouraged over goto since they usually make scripts more readable and maintainable.

Related

Break, Loop, While-loop, Blocks

Example

; This example displays 5 MsgBoxes, one for each number between 6 and 10.
; Note that in the first 5 iterations of the Loop, the "continue" command
; causes the loop to start over before it reaches the MsgBox line.
Loop, 10
{
    if A_Index <= 5
        continue
    MsgBox %A_Index%
}