Chapter
3 Programming the VIC 20
Computer
85
90
REM
INITIALIZE
VARIRBLE
)(
100
LET
)(=3.24
In statement
100,
floating point variable X
is
assigned the value 3.24
150
)(=3.24
Equivalent to statement
100
above; the LET
is
optional
in all assignment statements
215
AS
..
"ALSO
RAN"
The string variable
A$
is
assigned the two
text words ALSO RAN
Notice that the first assignment statement (line
100)
begins with the
word "LET", but the other two don't. Originally, all assignment statements
had to start with LET. The idea was
that
the computer could identify the
type
of
statement by looking at the first word. Today, all but a
few
dialects
of
BASIC have dropped this requirement. Although LET
is
not required by
VIC BASIC, it
is
still a reserved word and cannot appear in a variable name.
Here are three statements that assign values to array variable DP$(I),
which
we
encountered earlier when describing arrays.
200
REM
DP$(I)
IS
THE
DAIRY
PRODUCTS
SHOPPING
LIST
VARIABLE
210
DP$(0)="MILK"
220
DP$(1)="CREFlM"
230
DPf(2)="COTTAOE
CHEESE"
Remember, you can
put
more
than
one statement
on
a single line. The
three DP$ assignments could be placed
on
a single line as follows:
200
REM
DP$(I)
IS
THE
DAIRY
PRODUCTS
SHOPPING
LIST
VARIABLE
210
DP$(0)="MILK":DP$(1)="CREAM":DP$(2)="COTTAOE
CI-IEESE"
A colon must separate adjacent statements appearing on the same line.
Assignment statements can include any
of
the arithmetic
or
relational
operators described earlier in this chapter.
90
REM
THIS
IS
A
DUMB
WA
....
TO
ASSION
A
VALUE
TO
V
100
V=3.24+7.96/8.5