Analyzing
the Program
Look
through
the program
and
observe
these
many
features before we do some exercises to
change
it:
1.
The
REM statement
identifies
the
program
for
future use.
2. Line 20
uses
the CLS (Clear Screen) statement to erase the screen so we have a nice
clean
place to
write on. It
allows us to write in a top
down
manner. Run the program
later
leaving out this
line
and
see what is meant by the scroll mode, CLS is a very un-
fussy
statement which you
will
want to
use often just
to
make
your printouts
neat and
impressive.
3.
Line
30
initializes the value
of
D. D
will remain
at its initialized value,
4. Line
40
prints a chart heading which is indented
and double
spaced for appearance,
5.
Lines
50
and
70
use blank
PRINTs
to insert spaces in the chart.
6.
Line
60
prints the chart column headings, and
uses
automatic zone spacing to place
those
headings
(the comma).
7.
Line
80
establishes
theFOR-NEXT
loop complete with a STEP.
It
says
—
initialize the
rate (R) at
200
mph, and make passes through the
"do-loop"
with
values
of R incre-
mented by
values of
100
mph until
a
final value
of
1000
mph
is reached. Line
110
is
the other half of the
loop.
8.
Line
90
contains the actual formula which calculates the answer.
9.
Line
100
prints the three values. They are positioned under their headings by automat-
ic zone spacing
(the commas),
10.
Lines
90
and
100
are indented from the rest of the program
text.
This is a
simple
programming
technique highlighting a
do-loop which
makes reading
and
trouble-
shooting easier.
You will see it used
increasingly
as we move on. Try to adopt good
programming practices
like this
as you do the exercises.
Indenting
does
take
up
a
little
memory space, and
on
long programs in
their
final form it is often omitted.
Take
a deep
breath
and go back over any
points
you might
have
missed in this lesson. Copy
the program
onto
your Computer Cassette
Tape
because we
will
use
it
in
the next
Chapter
continuing
our
study
of FOR-NEXT loops.
CLS in a program does the
same
thing as the
|ct£AR|
Ke
y
on
the keyboard
(but you cant
use
the
(clear]
Key as part of
a program).
Remember zone
spacing?
n^Tite'
:
comma
{,}
inW-
:
FEINT
statement
automatically starts
the
prjntisg
=;jS;t&e next
IS-spacfeiprint
zone.
;='
51