Chapter
51
Basic
Concepts
*,
I
\
MOD
+,
-
Multiplication, Division. For example,
3*3
is 9,
and 1015 is 2.
Integer Division. BASIC rounds both operands
to
integers and truncates the result
to
an in-
teger. Integer division is faster than standard
division.
For
example,
10\4
is
2.
Modulus Arithmetic. BASIC performs integer
division as described above and returns the
remainder
as
an integer value. For example, 10
MOD
3
results in 1.
Addition, Subtraction. For example, 2+9 is
11,
and 15-8 is
7.
String Operator
The string operator is the plus sign
(
+
1.
It appends one string
to
another. All operands must be strings, and the resulting value is
1
string. For example:
PRINT "APRIL SHOWERS
'I
+
"BRING"
+
''
MAY
FLOWERS.
"
prints APRIL SHOWERS BRING MAY FLOWERS.
Relational Operators
Relational operators compare
2
pieces
of
numeric data or 2 pieces
of
string data. The result of the comparison is either
true
or
false.
If the relationship
is
true, BASIC returns
-1.
If the rela-
tionship is false, BASIC returns 0 (zero).
The relational operators are, in order of precedence:
Equal. Both operands are equal.
Less Than. The
first
operand is less
than
or
precedes the second operand.
Greater Than. The first operand is
greater than
or
follows the second
operand.
Inequality. The operands are not
equal.
- -
<
>
><
or
<>
52