Atari 65XE Owner's Manual page 65

Hide thumbs Also See for 65XE:
Table of Contents

Advertisement

The computer can count backward in increments also:
10 FOR JKL=500 TO 0 STEP -20
RUN
10 FOR JKL=500 TO 0 STEP -3
RUN
10 FOR JKL=0 TO -500 STEP -50
RUN
You can also instruct the computer to start and stop at any number
you desire:
10 FOR JKL = 500 TO 300 STEP -10
RUN
10 FOR JKL=25 TO 0 STEP -1
RUN
Now you know how to instruct the computer to count forward and
backward, to count consecutively and incrementally, and to start and
stop at specified numbers.
The FOR-NEXT "Sandwich" Loop
List your program. FOR is on the top line, and NEXT is on the bottom
line. Whatever you want the computer to do is sandwiched in between.
Type in the lines below:
10 FOR JKL=1 TO 5
20 PRINT " A V O C A D O "
The computer will carry out any instruction or number of instructions
between the FOR and NEXT statements the specified number of times.
Have the computer print other words:
16 PRINT "CHEESE"
17 PRINT "MAYONNAISE"
18 PRINT "MUSTARD"
19 PRINT "TOMATO"
21 PRINT "BACON BITS"
22 PRINT "LETTUCE"
23 PRINT:PRINT
RUN
The computer prints and counts too quickly for anyone to read the
screen clearly. Nonetheless, it prints the PRINT statement exactly five
times as instructed in the FOR-NEXT statement. Other instructions,
such as math computations and INPUT statements, can also be part
of the FOR-NEXT sandwich loop.
60

Advertisement

Table of Contents
loading

Table of Contents