Skip to content

CLEAR

Clear Program Environment

This directive initializes certain program parameters. It accomplishes actions similar to BEGIN, but does not affect input/output channels. It is part of a series of similar directives including BEGIN, END, RESET, and STOP.

CLEAR [EXCEPT variable-name [,variable-name...]]
variable-name
is the name of a numeric or string variable. This variable is not cleared to 0 or null by the CLEAR directive.

This directive:

  1. Initializes all variable values to 0 or null except those listed in the EXCEPT clause.
  2. Clears the Return Address Stack (used to hold address values for certain directives, i.e., FOR/NEXT, RETURN, RETRY, etc.).
  3. Sets value of ERR and CTL to 0.
  4. Sets PRECISION to 2, ends FLOATING POINT.
  5. Sets SETERR and SETESC to 0.
  6. Does not close any files or devices.
  7. Does not set program execution pointer to the first program line.
  8. Does not DROP public programs, which have been made resident by an ADDR directive.
  9. Does not DROP files, which have been added to the File Control Table by an ADD directive.
  10. Does not affect system variables such as TIM (Time) and DAY (Date).
  11. Does not terminate a SETTRACE directive.
CLEAR

affects the program parameters as described above, setting all numeric variables to 0 and all string variables to null.

CLEAR EXCEPT STRING_1$, NUM_A, A1$, ARRAY(ALL)

affects the program parameters as detailed above, but leaves STRING_1$, NUM_A, A1$, and ARRAY (numeric array) unchanged.

BEGIN, END, RESET, and STOP directives

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