EasyManua.ls Logo

Radio Shack TRS-80 - Page 99

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...
10 IN.
"TYPE IN
A
NUMBER";X
20
IF X =
3 THEN
50
s G.70
30 P.
"HOW
DID
YOU
GET
HERE?"
40 END
50 P.
"X
=3"
60
END
70 P.
"CAN'T
GET
FROM
THERE
TO
HERE."
.
. .
and
RUN it a
number
of times
with different
input
values.
Line
20
is illegal. If
the
test in the first
statement
in
the line
passes, control
branches
off
to
line
50.
That's OK. If the test fails,
however, control
drops
to the
next line
in the program
line
30.
There is
no
way the second
statement in line
20
(G.70) can ever
be executed.
THE
MESSAGE
-
if you put
an
IF-THEN
(or ON-GOTO)
type-test
in a multiple
statement
line,
it must be
the
last statement
in that
line.
Other
invalid
procedures
will
be called
to
your attention as
they
are studied
in future
chapters.
NEXT
MESSAGE
you cannot
send
control
to any point
in
a multiple
statement
line
except
to its first
statement.
Look
at Line
20
in the
resident
program.
Even
if the
G.70
was legal in
that line,
there is
no
way to
address it. It shares
the same line
number
as the
first
statement in the same
line. Only
the first statement
is addressable
by a GOTO or
IF-THEN.
NEXT
MESSAGE
DATA
lines
cannot
exist on lines with
other
statements.
EXERCISE 18-1:
Rewrite
any one
of the
programs found
in Part
C, using every
Radio
Shack Shorthand
feature
possible,
and
multiple
statement
lines.
Use the P.M.
(PRINT
MEMORY) test
to see
how much
memory is
being used.
Rework
the
program
to cut it
to
the smallest
memory
figure
possible.
97

Other manuals for Radio Shack TRS-80

Related product manuals