Download BASIC User`s Manual

Transcript
TSC BASIC User's Manual
4.6.3
Relational Operators
As the name implies, this group of operators tests the relation of
variables to other variables or constants. The six relational symbols
recognized by BASIC are:
RELATIONAL OPERATORS:
SYMBOL
EXAMPLE
=
<>
<
>
<=
>=
X=Y
X<>Y
X<Y
X>Y
X<=Y
X>=Y
MEANING
These are often combined with
complex tests. The statement:
X
X
X
X
X
X
the
is
is
is
is
is
is
equal to Y
not equal to
less than Y
greater that
less than or
greater than
Logical
Y
Y
equal to Y
or equal to Y
Operators
to
perform
660 IF A=O OR (C<127 AND D <> 0) GO TO 100
will cause a branch to statement 100 if A is equal to zero OR if both C
is less than 127 AND D is not equal to zero.
4.6.4 String Operators
The string operators consist of the concatenation operator ('+') and
the relational operators. The '+' operator will concatenate two strings
(join them together) to form a new string.
The relational operators,
when applied to string operands, indicate alphabetic sequence. If one
string is "less than" another, it implies it would appear before the
other if sorted into alphabetical order. In any string comparison,
trailing blanks are ignored. If two strings of unequal length are
compared, the shorter string is padded with trailing spaces to make it
equal in length to the other. A string of zero length (null string) is
considered to be completely blank and is less than any string of length
greater than zero unless the string is all spaces, then the two are
considered equal.
All of the standard arithmetic relational operators
may be used in connection with strings.
-12-