Statement: Transfers control to one of a set of labeled branch target statements based on the value of an expression. It is an obsolescent feature in Fortran 95.
Syntax
Rules and Behavior
When the computed GO TO statement is executed, the expression is evaluated first. The value of the expression represents the ordinal position of a label in the associated list of labels. Control is transferred to the statement identified by the label. For example, if the list contains (30,20,30,40) and the value of the expression is 2, control is transferred to the statement identified with label 20.
If the value of the expression is less than 1 or greater than the number of labels in the list, control is transferred to the next executable statement or construct following the computed GO TO statement.
Compatibility
CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB
See Also: GOTO - Unconditional GOTO, Execution Control
Examples
The following example shows valid computed GO TO statements:
GO TO (12,24,36), INDEX
GO TO (320,330,340,350,360), SITU(J,K) + 1
The following shows another example:
next = 1
C
C The following statement transfers control to statement 10:
C
GOTO (10, 20) next
...
10 CONTINUE
...
20 CONTINUE