FORTRAN 77 Language Reference

GO TO (Assigned)

The assigned GO TO statement branches to a statement label identified by the assigned label value of a variable.

GO TO i [[,](s[, s])]

Parameter 

Description 

i

Integer variable name 

s

Statement label of an executable statement 

Description

Execution proceeds as follows:

  1. At the time an assigned GO TO statement is executed, the variable i must have been assigned the label value of an executable statement in the same program unit as the assigned GO TO statement.

  2. If an assigned GO TO statement is executed, control transfers to a statement identified by i.

  3. If a list of statement labels is present, the statement label assigned to i must be one of the labels in the list.

Restrictions

i must be assigned by an ASSIGN statement in the same program unit as the GO TO statement.

i must be INTEGER*4 or INTEGER*8, not INTEGER*2.

s must be in the same program unit as the GO TO statement.

The same statement label can appear more than once in a GO TO statement.

The statement control jumps to must be executable, not DATA, ENTRY, FORMAT, or INCLUDE.

Control cannot jump into a DO, IF, ELSE IF, or ELSE block from outside the block.

Example

Example: Assigned GO TO:


       ASSIGN 10 TO N 
       ... 
       GO TO N ( 10, 20, 30, 40 ) 
       ... 
10     CONTINUE 
       ... 
40     STOP