Goto

Jumps to the specified label and continues execution.

Goto Label
Goto("Label")

Parameters

Label

Type: String

The name of the label to which to jump.

Remarks

Label can be a variable or expression only if parentheses are used. For example, Goto MyLabel and Goto("MyLabel") both jump to MyLabel:.

Performance is slightly reduced when using a dynamic label (that is, a variable or expression which returns a label name) because the target label must be "looked up" each time rather than only once when the script is first loaded. 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.

Related

Return, IsLabel, Else, Blocks, Break, Continue

Examples

#1

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