EasyManua.ls Logo

Radio Shack TRS-80 - Page 70

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...
As
the
screen
shows,
we
"bailed
out"
of
the
A loop
when
A
equalled
2
and
hit the
test line
at
55-
The END
in
line
99 is just a
precautionary
roadblock
set up to
stop
the
Computer
from
running
into line
100
unless
specifically
directed
to
go there.
That
would
never
happen
in
this
simple
program,
but
we will
use
protective ENDs from
time to
time
to
remind
us
that
lines
which
should
be
reached
only by
specific
GOTO or
IF-THEN
statements must
be
protected
against
accidental
"hits".
We'll
be
seeing a
lot
of
the nested FOR
-NEXT
loop now
that
we know
what it
is and
can
put it to
use
.
EXERCISE
13-1: Enter
the
original
program
found at
the
beginning
of
this
Chapter.
It
contains
a B
loop
nested
within
the
A loop.
Make the
necessary
additions to
this
program
so a
new loop
called "C"
will
be
nested
within the B
loop, and
will
print "C
LOOP"
4
times
for each
pass of
the B loop.
EXERCISE
13-2: Alter the
resident
program so
that it is the
same as
that
found in
the
answer
to
Exercise
13-1.
Make the
necessary
additions
to
this
program
so a
new loop
called
"D"
will be
nested
within
the C loop,
and
will
print "D
LOOP"
5
times
for
each
pass of the C
loop.
Learned in
Chapter 13
Miscellaneous
Nested
FOR-NEXT
loops
Protective
END
blocks
68

Other manuals for Radio Shack TRS-80

Related product manuals