Goto

Jumps to the specified label and continues execution.

Goto, Label

Parameters

Label

The name of the label to which to jump.

Remarks

When using a dynamic label such as %MyLabel%, an error dialog will be displayed if the label does not exist. To avoid this, call IsLabel() beforehand. For example:

if IsLabel(VarContainingLabelName)
    Goto %VarContainingLabelName%

The use of Goto is discouraged because it generally makes scripts less readable and harder to maintain. Consider using Else, Blocks, Break, and Continue as substitutes for Goto.

Gosub, Return, IsLabel(), Else, Blocks, Break, Continue, A_ThisLabel

Examples

Jumps to the label named "MyLabel" and continues execution.

Goto, MyLabel
; ...
MyLabel:
Sleep, 100
; ...