

Task

Show the syntax for a complete stoppage of a program inside a   conditional.

This includes all threads/processes which are part of your program.

Explain the cleanup (or lack thereof) caused by the termination (allocated memory, database connections, open files, object finalizers/destructors, run-on-exit hooks, etc.).

Unless otherwise described, no special cleanup outside that provided by the operating system is provided.




/*REXX program showing five ways to perform a REXX program termination. */
 
  /*─────1st way────────────────────────────────────────────────────────*/
exit
 
 
  /*─────2nd way────────────────────────────────────────────────────────*/
exit  (expression)     /*Note: the "expression" doesn't need parentheses*/
                       /*"expression"  is any REXX expression.          */
 
 
  /*─────3rd way────────────────────────────────────────────────────────*/
return                 /*which returns to this program's invoker.  If   */
                       /*this is the main body  (and not a subroutine), */
                       /*the REXX interpreter terminates the program.   */
 
 
  /*─────4th way────────────────────────────────────────────────────────*/
return (expression)    /* [See the note above concerning parentheses.]  */
 
 
  /*─────5th way────────────────────────────────────────────────────────*/
    /*control*/
    /*   │   */        /*if there is no EXIT and program control "falls */
    /*   │   */        /*through" to the "bottom" (end) of the program, */
    /*   │   */        /*an   EXIT   is simulated and the program is    */
    /*   │   */        /*terminated.                                    */
    /*   ↓   */
    /* e-o-f */        /* e-o-f   =   end-of-file.                      */