Flow-control structures: Difference between revisions

Content added Content deleted
(→‎Goto: add a little detail about restrictions)
(→‎exit: corrected text concerning the EXIT statement, added other verbage. -- ~~~~)
Line 1,621: Line 1,621:
=={{header|REXX}}==
=={{header|REXX}}==
===exit===
===exit===
The EXIT statement terminates the running (REXX) program and passes control to the invoking program (it could be the shell/host/supervisor program). If the invoking program is a REXX program, it also is terminated.
The EXIT statement terminates the running (REXX) program and passes control to the invoking program (it could be the shell/host/supervisor program).
If an expression is coded, it normally is used to set the RESULT (if a REXX program) or return code (also called RetCode, RC, completion code, or other such names).


Some operating systems require the expression to be a whole number within a certain range (often with a no expression or a [null] expression is usually taken to mean a return code of '''0''').
If an expression is coded, it normally is used to set the return code (also called return code, completion code, or other such names).


Some operating systems require the expression to be a whole number (often with a no expression or a [null] expression is usually taken to mean a return code of 0).
If the expression is a number, it is normalized to the current NUMERIC DIGITS.
<lang rexx>exit
<lang rexx>exit


exit expression</lang>
exit expression</lang>

===return===
===return===
The RETURN statement terminates the running (REXX) program and passes control to the invoking program (it could be the shell/host/supervisor program). If the invoking program isn't a REXX program, the RETURN statement acts like an EXIT.
The RETURN statement terminates the running (REXX) program and passes control to the invoking program (it could be the shell/host/supervisor program). If the invoking program isn't a REXX program, the RETURN statement acts like an EXIT.