Format: EXIT expr
Supported by: COMX BASIC V1.00, Floating Point BASIC 2.2, Pecom 32 BASIC, Pecom 64 BASIC 1.0 and 4.0, Quest Super BASIC 3.0, 5.0 and 6.0, RCA BASIC3 V1.1, Telmac SBASIC v 24.3
Similar commands: -
This statement is an unconditional branch to a line number defined by expr. It is intended for a premature escape from a FOR/NEXT loop or a subroutine. One precaution should be noted. If subroutines or FOR/NEXT loops are nested, the EXIT statement is designed to transfer control to a line number within the next level down of nesting. For example, if FOR/NEXT loops are nested four deep and it is desired to prematurely branch outside of the fourth FOR/NEXT loop, BASIC expects to be somewhere in the third FOR/NEXT loop after the EXIT has been executed. An EXIT may then be taken to some line within the second FOR/NEXT loop, and so on. This statement is used instead of the standard GOTO and is designed to clean up all of the modified stack pointers that result from a FOR/NEXT or a subroutine call. An example follows.