Exits (terminates) any type of loop statement.
Break , LoopLabel
- 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.
The use of Break and Continue are encouraged over Goto since they usually make scripts more readable and maintainable.
Continue, Loop, While-loop, For-loop, Blocks, Labels
Breaks the loop if var is greater than 25.
if (var > 25)
if (var <= 5)
Breaks the outer loop from within a nested loop.
x := A_Index
if (x*A_Index = 6)
break outer ; Equivalent to break 2 or goto break_outer.
break_outer: ; For goto.