Flow-control structures: Difference between revisions

m
→‎return: added text to explain that the program may be a REXX subroutine or function. -- ~~~~
(→‎exit: corrected text concerning the EXIT statement, added other verbage. -- ~~~~)
m (→‎return: added text to explain that the program may be a REXX subroutine or function. -- ~~~~)
Line 1,632:
 
===return===
The RETURN statement terminates the running (REXX) program (which could be a subroutine or function) 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.
 
If the invoking program isn't a REXX program, the RETURN statement acts like an EXIT statement.
 
If the invoker is a REXX program and the RETURN statement has no EXPRESSION coded, and the invoker expects a RESULT, a SYNTAX condition (error) is raised --- which usually results in an abnormal termination of the invoking REXX program (this condition can be trapped, however).
Line 1,638 ⟶ 1,640:
 
return expression</lang>
 
===signal===
The SIGNAL statement can be thought of as a GO TO statement, however, on issuance of a SIGNAL statement, all executing DO loops and SELECTs are terminated. Essentially, that means that there is no real way to re-enter a DO loop once a SIGNAL statement is used.