Keil Logo

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:


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
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.