EXIT

>>-EXIT--+------------+--;-------------------------------------><
         +-expression-+

EXIT leaves a program unconditionally. Optionally, EXIT returns a result object to the caller. The program is stopped immediately, even if an internal routine is being run. If no internal routine is active, RETURN (see RETURN) and EXIT are identical in their effect on the program running.

If you specify expression, it is evaluated and the object resulting from the evaluation is passed back to the caller when the program stops.

Example:

j=3
Exit j*4
/* Would exit with the string "12" */

If you do not specify expression, no data is passed back to the caller. If the program was called as a function, this is detected as an error.

You can also use EXIT within a method. The method is stopped immediately, and the result object, if specified, is returned to the sender. If the method has previously issued a REPLY instruction (see REPLY), the EXIT instruction must not include a result expression.

Notes:

  1. If the program was called through a command interface, an attempt is made to convert the returned value to a return code acceptable by the underlying operating system. The returned string must be a whole number whose value fits in a 16-bit signed integer (within the range -(2**15) to (2**15-1). If the conversion fails, no error is raised, and a return code of 0 is returned.

  2. If you do not specify EXIT, EXIT is implied at the end of the program, but no result value is returned.

  3. On Unix/Linux systems the returned value is limited to a numerical value between 0 and 255 (an unsigned byte).