2.2.2 Variables
The word "variable" has a different meaning with BASIC than it does when used with regard
to
alge-
braic expressions. To
put
it in very simple terms,
the
variables
of
BASIC are
"boxes"
in memory for
the storage
of
numbers and characters (character strings). The types
of
variables used in BASIC include
numeric variables, string variables, and system variables.
Numeric variables
Numeric variables
11
Jl
A V
String variables
XY$
Only numeric
data
can be stored in numeric variables.
System variables
~
f
SIZE V
Names must be assigned to these variables in
accord~mce
with
the following rules.
i) A variable name
may
consist
of
any
number
of
characters,
but
only the first two characters are
actually used by the BASIC interpreter to identify
the
variable.
Further
, the first character
of
the
variable. name
must
be a
letter
(A
to
Z), either letters
or
numerals may be used for subsequent
characters.
ii)
It
is
not
possible to use the names
of
BASIC commands and statements
as
variable names.
Correct variable names:
ABC
, XY, ABCD,
Al2345
(ABC and ABCD are regarded
as
the
same variable.)
Incorrect variable names:
PRINT .
..
.....
. . . (PRINT
is
a BASIC statement)
(Example:)
C@ . . . . . . . . . . . . . .
01
ariable names may
not
include special charac-
ters.)
1 0 A = 5 .
.. ..
...................... Stores 5 in variable A.
2 0 p R 1 N T A·······
··
·
··
.·. Displays the value stored in variable A.
22----------------
----
------------
----------
----
--
--------
----
------------