VARIABLES
Your computer uses three types of variables in BASIC. These are: normal
numeric, integer numeric, and string (alphanumeric) variables.
NUMERIC VARIABLES
Normal numeric variables, also called floating point variables, can have
any value from ^ -38 to ^ +38, with up to nine digits of accuracy. When
a number becomes larger than nine digits can show, as in 10 ^ -10 or
10 ^ +10, your computer displays it in scientific notation form, with
the number normalized to 1 digit and eight decimal places, followed by
the letter E and the power of ten by which the number is multiplied. For
example, the number 12345678901 is displayed as 1.23456789E+10.
INTEGER VARIABLES
Integer variables can be used when the number is from +32767 to -32768,
and with no fractional portion. An integer variable is a number like 5,
10, or -100. Integers take up less space than floating point variables
when used in an array.
STRING VARIABLES
String variables are those used for character data, which may contain
numbers, letters, and any other character that your computer can make.
An example of a string variable is "COMMODORE 16".
VARIABLE NAMES
Variable names may consist of a single letter, a letter followed by a
number, or two letters. Variable names may be longer than 2 characters,
but only the first two are significant.
An integer variable is specified by using the percent (%) sign after the
variable name. String variables have the dollar sign ($) after their
names.
Examples:
Numeric Variable Names: A, A5, BZ
Integer Variable Names: A%, A5%, BZ%
String Variable Names : A$, A5$,BZ$
ARRAYS
Arrays are lists of variables with the same name, using an extra number
(or numbers) to specify an element of the array. Arrays are defined
using the DIM statement, and may be floating point, integer, or string
variables arrays. The array variable name is followed by a set of
parentheses ( ) enclosing the number of the variable in the list.
Examples:
A(7), BZ%(11), A$(87)
Arrays may have more than one dimension. A two dimensional array may be
viewed as having rows and columns, with the first number identifying the
column and the second number in the parentheses identifying the row (as
if specifying a certain grid on a map).
Examples:
A(7,2), BZ%(2,3,4), A$(3,2)
RESERVED VARIABLE NAMES
There are seven variable names which are reserved for use by the
computer, and may not be used for another purpose. These are the
variables:
DS
DS$
EL
ER
ST
TI
TI$