GOTO Command¶
Material prepared from M Programming Book (Page 104) [WALTERS1997] and GT.M Programmer’s Guide
Description¶
GOTO entryref[:tvexpr]
The GOTO command transfers execution to the location specified by its argument, a label.
GOTO commands executed inside of a FOR loop terminate that FOR loop.
Parameters¶
entryref is a required argument that specifies the label to which execution will be transferred.
tvexpr is an optional argument that follows entryref which specifies one or more boolean expressions, at least one of which must be true. These expressions can control whether the GOTO is performed or which label the GOTO command transfers execution to.
Other commands on a line with a GOTO have no use unless there is a postconditional for the GOTO.
Examples¶
GOTO LABEL
This command causes execution to continue starting at the line labeled LABEL.
GOTO FACTORIZE+1
This command causes execution to continue starting one line after the line labeled FACTORIZE.
GOTO LENOVO:i<5,IBM^CENTER
This command causes execution to continue at label LENOVO if i is less than 5, or to label IBM in routine ^CENTER otherwise.