Visible to Intel only — GUID: GUID-C64D6C14-9410-48B7-8175-AA80283D96E3
Visible to Intel only — GUID: GUID-C64D6C14-9410-48B7-8175-AA80283D96E3
GOTO - Computed
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.
GOTO (label-list) [ ,] expr
label-list |
Is a list of labels (separated by commas) of valid branch target statements in the same scoping unit as the computed GO TO statement. (Also called the transfer list.) The same label can appear more than once in this list. |
expr |
Is a scalar numeric expression in the range 1 to n, where n is the number of statement labels in label-list. If necessary, it is converted to integer data type. |
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.
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