The computed GO TO statement transfers control to a statement based on the value of an expression within the statement. It takes the following form:
GO TO (slist)[,] e
The computed GO TO statement evaluates the expression e and, if necessary, converts the resulting value to integer data type. Control is transferred to the statement label in position e in the transfer list. For example, if the list contains (30,20,30,40) and the value of e is 2, control is transferred to statement 20.
If the value of e is less than 1 or greater than the number of labels in the transfer list, control is transferred to the first executable statement after the computed GO TO statement.
The following examples show valid computed GO TO statements:
GO TO (12,24,36), INDEX GO TO (320,330,340,350,360), SITU(J,K) + 1