qbasic.hlp (Topic list)
EXIT Statement
  Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
Exits a DO or FOR loop, a FUNCTION or SUB procedure, or a DEF FN function.
 
EXIT {DEF | DO | FOR | FUNCTION | SUB}
 
    ■ DEF         Exits a DEF FN function.
    ■ DO          Exits a DO loop.
    ■ FOR         Exits a FOR loop.
    ■ FUNCTION    Exits a FUNCTION procedure.
    ■ SUB         Exits a SUB procedure.
 
Example:
    i% = 0
    DO
        i% = i% + 1
        IF i% = 500 THEN EXIT DO
    LOOP
    PRINT "EXIT at"; i%
 
See Also    DEF FN    DO...LOOP    FOR...NEXT    FUNCTION    SUB