GOTO

The GOTO statement causes program execution to jump to the code at a specified label.

 

COMMAND SYNTAX

GOTO label[:]
GO TO label[:]
GO label[:]

 

SYNTAX ELEMENTS

The label should refer to an existing label within the current source code. Labels can be numeric or alphanumeric but alphanumeric labels must be terminated with a colon. Numeric labels can be terminated with a colon but it is not mandatory. The use of the colon in the GOTO statement is optional.

 

NOTES

The use of the GOTO command is not recommended as it obscures the readability of code and therefore is a hindrance to maintainability. All programs written using the GOTO construct can be written using structured statements such as LOOP and FOR. Opinions on this are divided but the consensus is that GOTO should be avoided.

One possibly acceptable use of the GOTO statement is to transfer execution to an error handler upon detection of a fatal error that will cause the program to terminate.

 

EXAMPLE

GOTO Exception  ;* jump to the exception handler
.....

Exception:* exception handler
....STOP


jBC