7.1.3.2 Assigned GO TO Statement

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:

GO TO var [[,] (label-list)]

var
Is a scalar integer variable.


label-list
Is a list of labels (separated by commas) of valid branch target statements in the same scoping unit as the assigned GO TO statement. The same label can appear more than once in this list.

Rules and Behavior

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.


Previous Page Next Page Table of Contents