REBOL for COBOL programmers

Go to table of contents Go to feedback page

EXIT

Date written: March 29, 2013
Date revised:
Date reviewed:

This page explains some REBOL equivalents of EXIT.


COBOL EXIT

The most common use of the EXIT statement seems to be in a situation like the one below, where a paragraph containing the EXIT verb can be used for escaping out of some procedure.

PERFORM paragraph-name-1 THRU paragraph-name-2.
...
paragraph-name-1.
    IF (some error condition)
        GO TO paragraph-name-2.
    (code to execute if no error)
paragraph-name-2.
    EXIT.

The REBOL equivalent

There is an "exit" function in REBOL that can be used in a similar way to quit a function. For example,

function-name-1: does [
    if (some error condition) [
        exit
    ]
    (code to execute if no error)
]
...
function-name-1   ;; Call the above function