# Break

Exits (terminates) any type of loop statement.

    Break , LoopLabel

## Parameters

LoopLabel [AHK_L 59+]
  LoopLabel identifies which loop this statement should apply to; either by label name or numeric nesting level. If omitted or 1, this statement applies to the innermost loop in which it is enclosed. LoopLabel must be a constant value - variables and expressions are not supported. If a label is specified, it must point directly at a loop statement.

## Remarks

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

## Related

Continue, Loop, While-loop, For-loop, Blocks, Labels

## Examples

#1

    Loop
    {
        ; ...
        if (var > 25)
            break
        ; ...
        if (var <= 5)
            continue
    }

#2: Break the outer loop from within a nested loop.

    outer:
    Loop 3
    {
        x := A_Index
        Loop 3
        {
            if (x*A_Index = 6)
                break outer  ; Equivalent to break 2 or goto break_outer.
            MsgBox %x%,%A_Index%
        }
    }
    break_outer: ; For goto.