Skip to main content
Version: 7.0

Exit (RETURN)

The exit operator creates an action that exits from the innermost enclosing action call. Control is passed to the first action following that call operator.

The exit operator can also specify the result of the surrounding action call. The supplied value becomes the result of that call: when the caller captures the result, the captured value comes from this operator; when the call is used as a value, this value is what the call yields. If the operator is used without a value, the result of the surrounding call is NULL.

Language

The syntax of the exit operator is described by the RETURN operator.

Examples

// bare exit
importFile {
LOCAL file = FILE ();
INPUT f = FILE DO {
file () <- f;
}

IF NOT file() THEN RETURN;
}

// exit with a value — the value becomes the result of the surrounding action call
priceBucket (INTEGER price) {
IF price > 1000 THEN RETURN 'high';
IF price > 100 THEN RETURN 'mid';
RETURN 'low';
}