EasyManua.ls Logo

Atari 800 - Page 27

Atari 800
30 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...
I)
Line 30 has
lF...THEN PRlNT "something":
COTO
60.
When the condition
following
lF is met,
i.e. when the
computer
f inds the
letters
Y-e-s
stored
in
the
place
in memory
labeled
A$, then the
rest of the
line
is followed.
lt
prints "Your
programming
career
has
just
begun."
The computer
encounters
the colon
(:)next.
This
tells
it
that
the
logical Iine
isn't over
yet,
another
command
is coming.
The COTO command
says
"skip
down
to
line 60 and
ignore the
lines in between."
When the condition
is not
met, i.e., when the computer
f inds Y-E-S or any other
characters
in A$
then
the
rest of
the
line is
ignored and the computer
goes
on to
the next
numbered
line. ln this case
line
40.
Line
40 works the same
way as
line 30.
lf
Y-E-S
has been entered
at line 20, then
its
condition
isn't met either
and
line 40 doesn't
print
anything.
lt
lust
goes
on to the
next numbered
line which
is
60.
(Notice
that there
is no line
50.)
Line 60
prints
its message
and since there are
no more
lines, the
program
ends and
REAIIYis
displayed.
lf
N-o has
been
entered
at line 20 then
all of the
line 40 is executed.
The
message
in line 40 is
printed
and
program
control
jumps
back to
line
10. This happens to
begin the
program
over
again.
Suppose
you,
the all-powerful
programmer,
wish
to
insist that the
user, the
person
who runs or uses
this
pro-
gram,
must
answer
"Yes"
or
"No"
before
the
program
ends.
You will want the
computer to
print
a message
whenever
something other
than
"Yes"
or
"No"
has been entered.
After this
message the
question
should
be
repeated on the display
screen.
Now
try
to
figure
out
what
line
to
add to
make the computer
do this.
Experi-
ment with
line 50 before
you go
on.
There are
many ways this
Iine may be
written. Here
is a line 50
which will do the
trick:
50 Print
"You
rrr.J$t
an$hrer'Yes'or'No'to
6c! ot-r.rrl Goto 10
Enter this
line,
list and
iun
this
revised
program
several
times.
To anticipate
what the
display
will
look Iike,
pre-
tend
you
are the
computer
and
follow the
program.
Remember that
computers
are
machines
which
blindly
stick to their
programs
no matter
how nonsensical the
results may be.
This
is why
the
design
stage
of
program-
ming is so
important.
lt is up to
you,
the
programmer,
to
plan
each
display the
user
will see, to
anticipate
what
the
user
will type
in response to
that display,
and to tell
the computer
what to do
with every
response.

Other manuals for Atari 800

Related product manuals