RETURN

 ────RETURN────┬──────────────┬───;────────────
                 └──expression──┘

RETURN is used to return control (and possibly a result) from a REXX program or internal routine to the point of its invocation.

If no internal routine (subroutine or function) is active, RETURN and EXIT are identical in their effect on the program that is being run.

If a subroutine is being processed (see the CALL instruction), expression (if any) is evaluated, control passes back to the caller, and the REXX special variable RESULT is set to the value of expression. If expression is omitted, the special variable RESULT is dropped (becomes uninitialized). The various settings saved at the time of the CALL (tracing, addresses, and so on) are also restored.

If a function is being processed, the action taken is identical, except that expression must be specified on the RETURN instruction. The result of expression is then used in the original expression at the point where the function was invoked.

If a PROCEDURE instruction was processed within the routine (subroutine or internal function), all variables of the current generation are dropped (and those of the previous generation are exposed) after expression is evaluated and before the result is used or assigned to RESULT.


[Back: QUEUE]
[Next: SAY]