A166 User's Guide

EXIT Function

The EXIT MPL function terminates expansion of the most recently called REPEAT, WHILE, or user-defined MPL function. It is most commonly used to avoid infinite loops like those found when a WHILE expression is never FALSE or a when a user-defined macro never terminates. Moreover, it enables several exit points from the same macro.

The syntax for EXIT is:

%EXIT

Source Text

%SET (count, 0)

%WHILE (1)
(%IF (%count GT 5) THEN (%EXIT)
  FI    DW   %count, -%count
%SET (count, %count + 1))

Output Text

DW   0, -0
DW   1, -1
DW   2, -2
DW   3, -3
DW   4, -4
DW   5, -5