Chapter
51
Basic
Concepts
This is true. If BASIC reaches the end of one string before find-
ing
2
characters that don’t match, the shorter string is consid-
ered the less of the two strings (lower in precedence). Therefore,
TRAIL
is the lesser of the two strings.
Also note that leading blanks are significant in string compari-
sons. Therefore,
‘‘
A”
comes before
“A”
because the ASCII code
for
blank is
32
and the ASCII code for A is
65.
Logical
Operators
Logical operators, or Boolean operators, make logical compari-
sons of numeric values. The logical operators are NOT, AND,
OR,
XOR,
EQV,
and
IMP.
They take a set
of
truelfalse values,
usually from relational expressions, and return a true or false
result.
The following table describes the result for
given the described truelfalse values.
Meaning
of
First
Operator Operation Operand
NOT
The result is the oppo-
1
site of the operand.
Q
AND
When both values are
1
true, the result is
1
true. Otherwise, the
0
result is false.
0
OR
When both values
1
are false, the
1
result is false.
0
Otherwise, the
0
result
is
true.
XOR
When one of the
1
values is true, the
1
result
is
true.
0
Otherwise, the
0
result is false.
When both values
1
are true or both
1
values are false,
0
the result
is
true.
0
IMP
The result is true
1
unless the first
1
value is true and
0
the second value
is
0
false.
EQV
each logical operator
Second
Operand Result
0
1
1
0
Q
0
1
1
1
0
1
0
0
1
1
1
0
0
1 1
0 0
1
0
0
1
1 1
8
0
1
1
0
1
54