Starting Point
List the program. The first number
in
the
FOR
line
is
the starting point
for the count, and the last number
is
the stopping point. Even negative
numbers can be the starting point for the count. Try these variations
for line 10:
1.0
FOR
JKL=1.
TO
5
RUN
1.0
FOR
JKL=O
TO
5
RUN
1.0
FOR
JKL=3
TO
5
RUN
1.0
FOR
JKL=-1.0
TO
5
RUN
STEP: Counting Incrementally
List the program, delete the PRINT statement
in
line 20 and the
comma
in
line 15, and
run
the program. The computer counts and
prints the numbers very
quickly. Use the S
TEP
command to make the
computer count
in
increments. Try the program below:
1.0
FOR
JKL=O
TO
500
STEP
5
RUN
1.0
FOR
JKL=O
TO
500
STEP
2
RUN
1.0
FOR
JKL=O
TO
500
STEP
1.00
RUN
1.0
FOR
JKL=O
TO
500
STEP
7
RUN
The computer will obligingly count by any sequence you specify.
Counting Backward
The computer can count backward if you use the
STEP
-1 command
and the proper sequence of numbers (from
larger to sma
ll
er) for
starting and stopping the count. For example:
1.0
FOR
JKL=500
TO
0
STEP
-1.
RUN
1.0
FOR
JKL=1.0
TO
0
STEP
-1.
RUN
1.0
FOR
JKL=-1.
TO
-1.~
STEP-1.
RUN
59