Flow-control structures: Difference between revisions
Content added Content deleted
Line 1,110: | Line 1,110: | ||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
===exit=== |
===exit=== |
||
The EXIT statement terminates the running (REXX) program and passes control to |
|||
<br> the invoking program (it could be the shell/host/supervisor program). |
<br> the invoking program (it could be the shell/host/supervisor program). |
||
<br> If the invoking program is a REXX program, it also is terminated. |
<br> If the invoking program is a REXX program, it also is terminated. |
||
Line 1,125: | Line 1,125: | ||
</lang> |
</lang> |
||
===return=== |
===return=== |
||
the RETURN statement terminates the running (REXX) program and passes control to |
|||
<br> the invoking program (it could be the shell/host/supervisor program). |
<br> the invoking program (it could be the shell/host/supervisor program). |
||
<br> If the invoking program isn't a REXX program, the RETURN statement acts like an EXIT. |
<br> If the invoking program isn't a REXX program, the RETURN statement acts like an EXIT. |
||
Line 1,139: | Line 1,139: | ||
</lang> |
</lang> |
||
===SIGNAL=== |
===SIGNAL=== |
||
The SIGNAL statement can be thought of as a GO TO statement, however, on issuance of |
|||
<br> a SIGNAL statement, all executing DO loops and SELECTs are terminated. |
<br> a SIGNAL statement, all executing DO loops and SELECTs are terminated. |
||
<br> Essentially, that means that there is no real way to re-enter a DO loop once a SIGNAL |
<br> Essentially, that means that there is no real way to re-enter a DO loop once a SIGNAL |
||
Line 1,203: | Line 1,203: | ||
</lang> |
</lang> |
||
===leave=== |
===leave=== |
||
The LEAVE statement transfer control to the next REXX statement following the END |
|||
<br> statment of the current DO loop. |
<br> statment of the current DO loop. |
||
<br> The LEAVE statement can also specify which DO loop is to be left if the DO loop has |
<br> The LEAVE statement can also specify which DO loop is to be left if the DO loop has |
||
Line 1,232: | Line 1,232: | ||
</lang> |
</lang> |
||
===iterate=== |
===iterate=== |
||
The ITERATE statement immediately transfer control to the DO statement, that is, it iterates |
|||
<br> (increments or decements) the named REXX variable that is specified on the DO statement. |
<br> (increments or decements) the named REXX variable that is specified on the DO statement. |
||
<br> The ITERATE statement can also specify which DO loop is to be iterated. |
<br> The ITERATE statement can also specify which DO loop is to be iterated. |
||
Line 1,262: | Line 1,262: | ||
</lang> |
</lang> |
||
===call=== |
===call=== |
||
The CALL statement immediately transfer control to a named subroutine, and the CALL |
|||
<br> statement may have any number (or none) parameters. |
<br> statement may have any number (or none) parameters. |
||
<br> The named subroutine may or may not return a RESULT (which is similar to a return code). |
<br> The named subroutine may or may not return a RESULT (which is similar to a return code). |
||
Line 1,286: | Line 1,286: | ||
</lang> |
</lang> |
||
===select=== |
===select=== |
||
The SELECT statement is used to conditionaly test for cases to selectively execute REXX |
|||
<br> statement(s). |
<br> statement(s). |
||
<lang rexx> |
<lang rexx> |