Lahey/Fujitsu Fortran

ASSIGN Statement (obsolescent)


The ASSIGN statement assigns a statement branch label to an INTEGER variable.


ASSIGN label TO assign-variable


label is a statement label.
assign-variable is a scalar INTEGER variable.


assign-variable must be a named variable of default INTEGER kind. It must not be a structure component or an array element.

label must be the target of a branch target statement or the label of a FORMAT statement in the same scoping unit.

When defined with an INTEGER value, assign-variable must not be used as a label.

When assigned a label, assign-variable must not be used as anything except a label.

The ASSIGN statement is an ancient construct that induces the coder to write "spaghetti code", leading to difficult to read and debug programs. The assigned GOTO construct has been replaced by the structured CASE Construct or IF Construct. The ASSIGN statement is obsolescent and should never be used when writing new code. However, it is fully supported by the compiler.


assign 100 to i 100 continue goto i

See Also

IF Construct

CASE Construct