bas7advr.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
EXIT Statement Details
  ◄Syntax►  ◄Details►  ◄Example►                 ◄Contents►  ◄Index►  ◄Back►
──────────────────────────────────────────────────────────────────────────────
The EXIT statement exits a DEF FN function, DO...LOOP, FOR...NEXT loop, or
a FUNCTION or SUB procedure.
 
EXIT {DEF | DO | FOR | FUNCTION | SUB}
    ■ 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. 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, transfers out of the immediately
      enclosing loop.
    ■ EXIT FOR provides another way to exit a FOR...NEXT loop. can
      appear only in a FOR...NEXT loop; 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. 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. Can be used
      only in a SUB procedure.
 
Usage Notes
    ■ None of the EXIT statements defines the end of the structure in which
      it is used. EXIT statements provide only an alternative exit from
      the structure.