CHAPTER
8
FROM
BASIC
TO
SUPERBASIC
ALPHABETIC
COMPARISONS
38
•
If
you are familiar with one of the earlier versions of
BASIC
you may find
it
possible
to
omit the
first
seven
chapters and use this chapter instead as a bridge between what
you
know already and the remaining chapters.
If
you
do this and
still
find areas
of
difficulty
It
may be helpful
to
backtrack a little into some of the earlier chapters.
If
you
have worked through the earlier chapters this one should be easy reading.
You
may find
that,
as
well
as introducing some new ideas,
it
gives an interesting slant on
the
way
BASIC
is
developing. Apart from
its
program structuring facilities SuperBASIC
also pushes forward the frontiers of good screen presentation, editing, operating facilities
and graphics.
In
short
It
is
a combination
of
user-friendliness and computing power which
has not
eXisted
before.
So,
when you make the transition from
BASIC
to
SuperBASIC you are moving not only
to
a more powertul, more helpful language,
you
are also moving into a rer1)arkably
advanced computing environment.
We
will now discuss some of the main features of SuperBASIC and some of the features •
which distinguish
it
from other
BASICs.
The usual simple arithmetic comparisons are possible.
You
can write:
LET
pet1$
;:
"CAT"
LET
pet2$
= "DOG"
IF
petl$
<
pet2$
THEN
PRINT
"Meow"
The output will be Meow because
in
this context the symbol < means:
earlier (nearer to A
in
the alphabet)
SuperBASIC makes comparisons sensible. For example you would expect:
tat'
to
come before
'DOG'
and
'ERD98L:
to
come before
'ERD746L:
A simplistic approach, blindly using internal character coding, would give the wrong'
result
in
both the above cases but try the following program which finds the earliest' •
of
two
character strings.
100
INPUT
item1$.
item2$
110
IF
item1$
<
item2$
THEN
PRINT
iteml$
120
IF
item1$
=
item2$
THEN
PRINT
"EquaL"
130
IF
item1$
>
item
2$
THEN
PRINT
item2$
INPUT
OUTPUT
cat
dog
cat
cat
DOG
cat
ERD98L ERD746L
ERD98L
ABC
abc
ABC
The Concept Reference Guide section will give
full
details about the way comparisons
of strings are made
in
SuperBASIG
•
12/84