BASIC
Operators fall into
four categories:
•
Numeric
•
String
•
Relational
•
Logical
based on
the kinds of operands
they require and the results they
produce.
Numeric Operators
Numeric
Operators are used in numeric expressions.
Their
operands must always
be
numeric, and the result they produce is one numeric data item.
In the descriptions below
, we
use the terms integer , single-precision
,
and
double-precision operations. Integer operations involve two-byte operands,
single-precision operations involve four-byte operands, and double-precision
operations involve eight-byte operands. The more bytes involved, the slower the
operation.
There are five different numeric operators. Two of them, sign + and sign
—
,
are
unary, that is, they have only
one operand. A
sign operator has no effect on the
precision of its operand.
For
example,
in
the statement:
PRINT
-77,
+77
the sign operators
—
and
+
produce the values negative 77 and positive
77,
respectively.
Note:
When no sign operator appears in front of
a
numeric term, + is assumed.
The other numeric operators are all binary, that
is, they all take two operands.
These operators are:
+ Addition
-
Subtraction
*
Multiplication
/
Division
[
or
(D
Exponentiation. Press
the
(D
key to type in this operator.
113