Computed GOTO allows branching of the program according to the value of an integer expression.
GOTO (label_1, label_2,... label_n) scalar-integer-expression
If scalar-integer-expression
is equal to 1 the program continues at statement label label_1
, if it is equal to 2 it goes to label_2
and so on. If it is less then 1
or larger than n
program continues on next line.
Example:
ivar = 2
...
GOTO (10, 20, 30, 40) ivar
will jump to statement label 20.
This form of goto
is obsolescent in Fortran 95 and later, being superseded by the select case
construct.