68
The
VIC
20
User
Guide
Operators
The BASIC statement
lee
?l0.
2+4."
tells the VIC to add 10.2 and 4.7, and then display the sum. The statement
250
C-Fl+B
tells the VIC to add the two floating point numbers represented
by
the
variable names A and
B,
and to assign the sum to the floating point number
represented
by
the variable name
C.
The plus sign specifies addition. The plus sign
is
referred to
as
an
operator.
It
is
an
arithmetic operator, since addition
is
an arithmetic opera-
tion. There are two other types of operators: relational operators and
Boolean operators. These take a little more explanation, since they reflect
conditions and decisions, rather than arithmetic.
Table
3-2
summarizes the BASIC operators.
We
will
examine each
group of operators in turn, beginning with arithmetic operators.
TABLE
3·2. Operators
Precedence
Operator
Meaning
High
9
()
Parentheses denote order
of
evaluation
8
I
Exponentiation
.!:!
~
7
-
Unary minus
~
=
E'ii
6
•
Multiplication
.c:
..
6
/
Division
...
a.
...
=-
.<0
5
+ Addition
5
- Subtraction
4
=
Equal
-
'"
4
<>
Not equal
"
..
= =
=
...
4
<
Less than
i f
4
>
Greater than
-as!.
=:0
4
<=
or=<
Less than
or
equal
4
>=
or=>
Greater than.
or
equal
'"
3
N01
Logical
complement
=
..
" =
2
AND Logical AND
a.'"
-
".
=
..
I
OR
Logical
OR
=
a.
==-
Low
0