Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

GOTO - Assigned

Statement: Transfers control to the statement whose label was most recently assigned to a variable. This feature has been deleted in the Fortran Standard. Intel® Fortran fully supports features deleted in the Fortran Standard.

GOTO var[[ ,] ( label-list)]

var

Is a scalar integer variable.

label-list

Is a list of labels (separated by commas) of valid branch target statements in the same scoping unit as the assigned GO TO statement. The same label can appear more than once in this list.

The variable must have a statement label value assigned to it by an ASSIGN statement (not an arithmetic assignment statement) before the GO TO statement is executed.

If a list of labels appears, the statement label assigned to the variable is not checked against the labels in the list.

Both the assigned GO TO statement and its associated ASSIGN statement must be in the same scoping unit.

Example

The following example is equivalent to GO TO 200:

  ASSIGN 200 TO IGO
  GO TO IGO

The following example is equivalent to GO TO 450:

  ASSIGN 450 TO IBEG
  GO TO IBEG, (300,450,1000,25)

The following example shows an invalid use of an assigned variable:

  ASSIGN 10 TO I
  J = I
  GO TO J

In this case, variable J is not the variable assigned to, so it cannot be used in the assigned GO TO statement.

The following shows another example:

      ASSIGN 10 TO N
      GOTO N
  10  CONTINUE

The following example uses an assigned GOTO statement with a label-list but it is not checked against the value of VIEW:

  ASSIGN 300 TO VIEW
      GOTO VIEW (100, 200, 400)   ! this will go to label 300