GOTO - Assigned

Statement: Transfers control to the statement whose label was most recently assigned to a variable. This feature has been deleted in Fortran 95; it was obsolescent in Fortran 90. Compaq Fortran fully supports features deleted in Fortran 95.

Syntax

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.

Rules and Behavior

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 must be one of the labels in the list.

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

Compatibility

CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB

See Also: Obsolescent Features in Fortran 90, GOTO - Computed GOTO, GOTO - Unconditional GOTO, Execution Control

Examples

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 to check the value of view:

  C   Show user appropriate view of data depending on
  C   security clearance.
      GOTO view (100, 200, 400)