EasyManua.ls Logo

Radio Shack TRS-80

Radio Shack TRS-80
236 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Now
let's
examine the
program line
by line.
Line
10
establishes
the
fact that
A has a value
of 5.
Line
20
is an IF-THEN
statement
which
directs
the
Computer
to
go to
line
50
IF
the
value
of
A is exactly
5,
skipping
over
whatever
might
be
inbetween
lines
20
and
50.
Since A does
equal
5,
the Computer
jumps
to line
50
and
does
as
it
says, printing
A
EQUALS
5. Line
30
and
40
are not
used at
all
in this
case.
Now,
change
line
10
to read:
10 A =
6
and RUN
The
run should
say:
A
DOES NOT
EQUAL
5.
Taking
it
a
line
at a time
:
Line
10
establishes the
value
of
A to
be
6.
Line
20
tests the value
of
A. If
A equals
5,
THEN the
Computer is
directed
to go to line
50.
But "the
test fails",
that is, A
does NOT
equal
5,
so
the
Computer
proceeds
as usual
to the
next
line,
line
30.
Line
30
directs
the
Computer
to print
the
fact that A
DOES
NOT
EQUAL
5. It does
not
tell
us what the
value
of
A is, only
that
it
does not
equal
5. The
Computer
then
proceeds
on
to the next line.
Line
40
ENDs the
program's
execution.
Without
this
statement
separating
lines
30
and
50,
the
Computer
would
charge
right
on
to line
50
and
print its
contents,
which
obviously
are
in
conflict
with the
contents
of
line
30.
This is
an example
of
using
an
IF-THEN
statement
with
only the
most
fundamental
relational
operator,
the
equals sign.
Now
let's
see
if
you can
accomplish
the
same thing
by using
the
"does
not
equal"
sign:
30

Other manuals for Radio Shack TRS-80

Related product manuals