Radio Shack TRS-80 User Manual page 31

Micro computer system
Hide thumbs Also See for TRS-80:
Table of Contents

Advertisement

Chapter
6
IF you
liked
Chapter
1
through
5,
THEN
you're going
to
love the
rest
of
this
book!
Because we're
really just
getting into
the
good
stuff.
Like
IF-THEN
and
GOTO
statements
that
let
your
Computer make
decisions
and
take
.
.
.
er,
executive
action.
But
first,
a
few
more
operators
.
.
.
Relational operators allow the
Computer
to
compare one
value
with another.
There
are
only
three
:
1.
Equals, using the
symbol =
(How'd you
guess?)
2.
Is
greater than, using the
symbol
>
3. Is
less
than, using the
symboK
Combining
these three,
we come
up
with
three
more
operators:
4.
Is
not equal
to,
using the
symbolo
5. Is less
than or equal
to,
using the
symbol< =
6. Is
greater
than or equal
to,
using the
symbol
> =
By
adding
these
six
relational
operators to the four
math
operators
we
already
know,
plus
new
STA TEMENTs,
called
IF-THEN,
& GOTO,
we
create
a
powerful system of comparing
and
calculating that
becomes
the central core
of everything
else
that follows.
The
IF-THEN
statement,
combined
with the
six relational
operators above,
gives
us
the
action part
of a system of
logic.
Enter
and
RUN
this
program:
10 A =
5
20 IF
A
=
5
THEN
50
30
PRINT "A DOES NOT EQUAL 5."
40
END
50
PRINT
"A
EQUALS 5-"
The
screen
should
display:
A
EQUALS
5.
THEV GOTTA MAKE
IT
A
MOVIE/"
'''
'
- :
"'.:\'
:
.\l:'-'.v.:\\
"i
R&ample:
A<
B
means
A
is
less
tnte
B.
Toheh>
;
/'you distinguish
betw«en< and
>y
just
remember
'
:''.
that
the smaller part
of the<synibal
points
ito ttte:
smaller of the
two
quantities
being
compared.
29

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents