The assigned GO TO statement transfers control to the statement whose label was most recently assigned to a variable. The assigned GO TO statement takes the following form:
The variable must have a statement label value assigned to it by an ASSIGN statement (not an arithmetic assignment statement) before the GO TO statement is executed.
If a list of labels appears, the statement label assigned to the variable must be one of the labels in the list.
Both the assigned GO TO statement and its associated ASSIGN statement must be in the same scoping unit.
Examples
The following example is equivalent to GO TO 200
:
ASSIGN 200 TO IGO
GO TO IGO
The following example is equivalent to GO TO 450
:
ASSIGN 450 TO IBEG
GO TO IBEG, (300,450,1000,25)
The following example shows an invalid use of an assigned variable:
ASSIGN 10 TO I
J = I
GO TO J
In this case, variable J is not the variable assigned to, so it cannot be used in the assigned GO TO statement.