EXIT Statement Details
◄Summary► ◄Details► ◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
EXIT {DEF | DO | FOR | FUNCTION | SUB}
Usage Notes
■ EXIT statements do not define the end of the structure in which they
are used. EXIT statements provide only an alternative exit from the
structure.
■ EXIT DEF causes an immediate exit from the executing DEF FN function.
Program execution continues where the DEF FN function was invoked.
■ EXIT DO provides an alternative exit from a DO...LOOP. It can be used
only inside a DO...LOOP statement; EXIT DO transfers control to the
statement following the LOOP statement. When used within nested
DO...LOOP statements, it transfers out of the immediately enclosing
loop.
■ EXIT FOR provides another way to exit a FOR...NEXT loop. It can appear
only in a FOR...NEXT loop; EXIT FOR transfers control to the statement
following the NEXT statement. When used within nested FOR...NEXT loops,
transfers out of the immediately enclosing loop.
■ EXIT FUNCTION causes an immediate exit from a FUNCTION procedure.
Program execution continues where the FUNCTION was invoked. It can be
used only in a FUNCTION procedure.
■ EXIT SUB immediately exits a SUB procedure. Program execution continues
with the statement after the CALL statement. It can be used only in a
SUB procedure.