Specifications

Chapter 5. Data Types
67
5.2.2 Classification of Variables
Work Variables
A work variable is intended for general use. You may use it either by declaring with the DIM
statement as a non-array variable or without declaration as an array variable. The following
examples show work variables:
DIM a(10),b%(5),c$(1)
d=100:e%=45
FOR count% = s1% TO s2%
NEXT count%
At the start of a user program, the Interpreter initializes all of the work variables to zero (0) or a
null character string. At the end of the program, all of these variables will be deleted.
Upon execution of the
DIM statement declaring an array variable, the Interpreter allocates the
memory for the array variable. The declared array variable can be deleted by the
ERASE
statement.
Common Variables
A common variable is declared by the COMMON statement. It is used to pass its value to the
chained-to programs.
Register Variables
A register variable is a unique non-volatile variable supported exclusively by BHT-BASIC. It
will retain its value (by battery backup) even after the program has terminated or the BHT
power has been turned off. Therefore, it should be used to store settings of programs and
other values in the memory.
The Interpreter stores register variables in the register variables area of the memory which is
different from the work variables area.
Like other variables, register variables are classified into two types: string variables and
numeric variables, each of which is subclassified into non-array and array types.
The format of register variables is identical with that of general variables. However, you need to
declare register variables including non-array register variables with
DEFREG statements.
BHT-BASIC can handle array variables up to two-dimensional.