Skip to content

EXITTO

Unconditional Branch and Clear Return Address

This directive acts as a GOTO with the additional feature that it removes one layer from the stack of addresses. An address is added to this stack when the program executes a FOR directive, [ON] GOSUB directive, WHILE/WEND directive, or when you press the Escape key with a SETESC directive active. In simpler terms, this is the proper method of leaving an uncompleted FOR/NEXT loop or [ON] GOSUB/RETURN subroutine, or removing the memory of where a program was executing when it was interrupted by the Escape key.

EXITTO line-ref
line-ref
is the program line number or label to branch to.

For nested loops or subroutines, this directive removes the most current or lowest layer from the stack of addresses.

This directive can only be used in Thoroughbred Basic Run Mode. If you try to use this directive in Thoroughbred Basic Console Mode, an ERR=45 results.

Extreme caution should be exercised when using the EXITTO directive. It is important that the programmer truly know which return address layer is being removed by this directive when it is actually executed.

EXITTO 8976

branches to program line 8976 and removes the address of the most recent GOSUB, FOR, or SETESC/ESCape key operation.

FOR I = 1 TO LEN(A$);
IF A$(I,1) = "X" THEN
EXITTO 1000
ELSE
NEXT I

searches through the string variable A$ looking for the character “X” and terminates the FOR/NEXT loop with I = the character position of “X”. If “X” is found, it branches to line 1000. If no “X” is found the FOR/NEXT loop ends normally and execution continues with the next program line after the NEXT I.

GOTO directive

From the Thoroughbred Basic Language Reference, Volume I: A–E, version 8.9.1. Open this page in the PDF