FORTRAN Reference Manual

Statements
FORTRAN Reference Manual528615-001
7-96
RETURN Statement
A RETURN statement without an iexp entry returns control to the first executable
statement that follows the statement which called it. The iexp entry, which must
be an integer expression, specifies that control return to the statement label
specified in the calling statement that corresponds to the position of the alternate
return expression in the actual parameter list of the calling program unit.
If FORTRAN cannot execute an alternate return because the value for iexp is less
than one or greater than the number of dummy arguments, control passes to the
first executable statement after the CALL statement.
Executing a RETURN statement terminates the association of actual arguments
with dummy arguments in a subprogram. For information about how to preserve
associated values after exiting a subprogram, see the SAVE Statement on
page 7-99.
Example
In the following example, control passes to statement 100 if the first RETURN
statement executes, and to statement 230 if the second RETURN statement executes:
PROGRAM MAIN
CALL products (price, tax, *100, *230)
.
END
SUBROUTINE products (p, t, *, *)
.
RETURN 1
.
RETURN 2
.
END