EXECUTE
Execute Thoroughbred Basic Console Mode Instruction from Program
This directive provides Thoroughbred Basic Console Mode operations while in Thoroughbred Basic Run Mode and allows dynamic alteration of programs.
Syntax
Section titled “Syntax”EXECUTE string-value [,OPT="LOCAL"]string-value- is a string that contains a Thoroughbred Basic program line.
Remarks
Section titled “Remarks”This directive can be used in Thoroughbred Basic Run Mode only. If an attempt is made to execute this directive in Thoroughbred Basic Console Mode, an ERR=45 results.
When this directive is executed, the string-value is treated as if a programmer had typed in the string-value in Thoroughbred Basic Console Mode and terminated it by pressing the Enter key.
If the string-value used as data does not include a program line number, it must be executable as a Thoroughbred Basic Console Mode directive or an ERR=45 results.
When EXECUTE is placed in a public program and the string-value used as data includes a line number, the program line will be merged into the public program if OPT=“LOCAL” is included. The program line will be merged into the main RUNning program, not on the public program that contains it if OPT=“LOCAL” is omitted.
Examples
Section titled “Examples”EXECUTE "X=34"This directive immediately causes X to have the value 34.
EXECUTE F$If F$=“4467 X=54+H” this inserts the program line:
04467 LET X = 54 + Hinto the main RUNning program, whether the EXECUTE comes from within the main RUNning program or a public program which has been CALLed.
EXECUTE F$,OPT="LOCAL"If F$=“4467 X=54+H this inserts the program line into the current public program.
EXECUTE D$If D$=“DEF FNX(A)=A+1” produces an ERR=45 because the DEF FN directive can only be used in Thoroughbred Basic Run Mode and it requires a program line number.
EXECUTE "100"+D$If D$=“DEF FNX(A)=A+1” inserts the program line into the program as program line 00100.
EXECUTE "11REM"+QUO+"LAST RUN ON"+DAY+QUOEXECUTE "SAVE PGN"changes line 00011 in the current program (whose name is in the system variable PGN) to show today’s date and SAVE the program back on disk before continuing program execution thus keeping a record of the last date when this program is RUN.
See also
Section titled “See also”CPP function
From the Thoroughbred Basic Language Reference, Volume I: A–E, version 8.9.1. Open this page in the PDF