Chapter 2
How To
Expand A
Program
You now
have a program in the
Computer, (If
you turned it off between lessons, fire
it
up
again
and type
in line
10
from Chapter
1.)
It's only
a
one-liner, but let's expand
it
by adding
a
second
line. In BASIC, every line in the program
must have a number, and the program is
executed
in order
from the smallest
number
to the largest. Type:
20 PRINT "YOU
CALLED,
MASTER. DD
YOU HAVE A COMMAND?"
Check it carefully
—
especially the quote marks, then
RUN
wim;i
If
all was correct, the screen
will
read:
HELLO THERE. I AM YOUR NEW TRS-80
MICROCOMPUTER!
YDU CALLED, MASTER.
DO YOU
HAVE
A COMMAND?
If it ran OK, answer the question by typing
yes
BSED
Oh
—
sorry about
that!
It "bombed",
didn't
it? The
screen
said,
WHAT?
This error message is the result of a built-in troubleshooter which lets you know when
you've said the wrong thing {or the right thing at the wrong time), The
WHAT?
message on
the screen says, "No-no, dummy
—
the
program
you
wrote doesn't have
any
way
for me
to
accept an answer just because
it
asked a
question" or
words
to
that
effect.
A later lesson will cover another error
message.
Meanwhile,
if
you
get a WHAT?
,
HOW?
or
SORRY
,
go
back and
examine
the
program
for
an
error.
Your "YES"
answer here was
used
purposely
to
show an
error
message.
Later on,
we'll
program the Computer to accept a
"YES" or
"NO"
answer
and
act
on it.
Have you
noticed that we use for
the
h&niber
;
zero
—
so you can distinguish
between
the
letter:
m&
number. The Video Display
does it
this way
so
well
do the same throughout the
Manual.
'WHAT?'
n