Sometimes the delay loop is sandwiched on the same program line:
NEW
10 FOR DELAY=1 TO 3 0 0 : N E X T D E L A Y
LIST
R U N
Sample Programs
The programs below use FOR-NEXT loops in a variety of ways. The
first program uses the FOR-NEXT loop as a simple delay loop to leave
the word HI on the screen long enough to be read before line 30
clears the screen:
NEW
1 REM *** DLAYLOOP ***
5 PRINT " "
10 PRINT "HI"
20 FOR DELAY=1 TO 800:NEXT D E L A Y
30 PRINT " "
40 PRINT "BYE"
50 FOR DELAY=1 TO 800 : N E X T DELAY
The next program uses a numeric variable in the FOR-NEXT loop. It
also uses a TRAP command that refers the computer back to the
previous line, giving no specific message about the error:
NEW
1 REM *** HOWHIGH? ***
10 DIM A$ (1), HH$(1)
20 PRINT " "
30 PRINT:PRINT "HOW HIGH DO YOU W A N T TO COUNT";
40 T R A P 30
50 INPUT HH
55 HH$=STR$(HH) : IF HH$="0" THEN GOTO 30
60 FOR C O U N T = 1 TO HH
70 PRINT C O U N T
80 N E X T C O U N T
90 PRINT :PRINT "PLEASE A N S W E R (Y/N) . WOULD YOU LIKE TO
C O U N T A G A I N " ;
100 TRAP 90
110 INPUT A$
120 IF A $ = " Y " THEN GOTO 30
130 IF A $ = " N " THEN PRINT:PRINT "BYE":END
140 GOTO 90
The last program paraphrases an old rock 'n' roll song and uses
"nested" FOR-NEXT loops. A nested FOR-NEXT loop is a smaller
delay loop inside a larger FOR-NEXT loop. The program also uses OR
to create multiple conditions in the IF-THEN statement:
62
Summary of Contents for 65XE
Page 1: ...ATARI 65XE PERSONAL COMPUTER OWNER S MANUAL TM...
Page 3: ...ATARI 65XE PERSONAL COMPUTER TM...
Page 6: ...Part 1 GettingStarted 1...
Page 9: ...4...
Page 23: ...18...
Page 25: ...20...
Page 32: ...Part 2 Programming withATARI BASIC 27...
Page 33: ...28...
Page 59: ...54...
Page 69: ...64...
Page 82: ...Part3 Appendices 77...
Page 83: ...78...
Page 97: ...92...
Page 105: ...100...
Page 125: ...120...
Page 126: ...121 Index...
Page 127: ...122...
Page 134: ...ATARI 1987 Atari Corp All Rights Reserved Printed in Taiwan C072018 001 REV B K l 2 1987...
Page 135: ......