ESCAPE WHEN
Conditional Escape from Program Execution
This directive causes an escape from the program when a specified condition is met.
Syntax
Section titled “Syntax”ESCAPE WHEN conditioncondition- is a relational, Boolean, and/or logical expression used to establish a true or false condition.
Remarks
Section titled “Remarks”This directive cannot be executed from Thoroughbred Basic Console Mode. It must be in a program.
The directive must be executed for the conditional to be in effect.
The conditional is checked after each directive is executed.
ESCAPE WHEN is only valid for the program in which it resides. It is not valid for any programs called by the program that contains the ESCAPE WHEN.
Once the ESCAPE WHEN condition is met, Thoroughbred Basic does not continue to process any other ESCAPE WHEN conditions.
Only one ESCAPE WHEN can be in effect at a time. Executing an ESCAPE WHEN after one has already been executed supersedes the first one. To get multiple conditions, use connecting OR operators.
The ESCAPE WHEN directive is a debugging tool. Including this directive slows program execution.
Examples
Section titled “Examples”The following program:
00010 REM PROGNAME00020 ESCAPE WHEN I=3 OR I=900030 FOR I=1 TO 1000040 PRINT I00050 NEXT Iproduces the following output:
>RUN"PROGNAME"12
>>ESCAPE CONDITION ENCOUNTERED<<>>00050 NEXT IThis program stops executing at line 00050, when the first ESCAPE WHEN (I=3) condition is true. The message “ESCAPE CONDITION ENCOUNTERED” and the line that caused the ESCAPE are displayed in Thoroughbred Basic Console Mode. At this point, Thoroughbred Basic clears the ESCAPE WHEN conditions. When the second condition is met (I=9), no ESCAPE WHEN processing occurs.
See also
Section titled “See also”ESCAPE directive
From the Thoroughbred Basic Language Reference, Volume I: A–E, version 8.9.1. Open this page in the PDF