Radio Shack TRS-80 User Manual page 195

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

Advertisement

26
IF X
>0
THEN
T =
+1
30
ON T+2
GOTO 50,60,70
4 5
END
50
PRINT
"
THE NUMBER
IS
NEGATIVE."
55
END
60
PRINT
"
THE NUMBER
IS
ZERO."
65
END
70
PRINT
"
THE NUMBER
IS
POSITIVE."
1
SAMPLE
ANSWER FOR
EXERCISE
1
6-1
:
3
PRINT
"
SEE MY FOXY
"
;
5
FOR
N =
1
TO
2
10
READ A$
20
DATA RADIO SHACK, TRS-80
30
PRINT
A$;
"
"
,
40
NEXT
N
WKsmammmm
Analysis
:
Line 3
PRINTs
the
first
part,
leaving a
space
for
the
printing
from
the
upcoming A$, and
has
a
trailing
semicolon
so
the
carriage
return
is
suppressed.
Line 5
establishes
a two-pass
FOR-NEXT
loop.
Line 10
Reads
RADIO SHACK
Line
20
contains the
two
DATA
strings,
separated
by
a
comma
Line
30
PRINTs
RADIO SHACK
and
a space
on
the
first
pass
of the
N
loop.
Note
the
trailing
semi-colon
to again
suppress the
carriage return.
Line
40
returns control to
line
5
and
the loop.
The
second
pass
through
the
loop
PRINTs
TRS-80
(and another
space,
but
it
doesn't matter),
finishing
the
job.
193

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents