The computed GO TO 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.
The computed GO TO statement takes the following form:
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.
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
For More Information:
For details on obsolescent features in Fortran 95, see Appendix A.