Line
320
in the L loop stores the ones and zeros in the array. The end of
line 330 makes X alternate between zero and one.
To print out the contents of the array at this point, type:
5 LPRINT CHR$(27)"Q"CHR$(44)
110 FOR K=l TO C: LPRINT A(K);: NEXT K:
LPRINT.
.
LPRINT "C="C
and RUN your growing program. Figure
14-1
shows the first seven
lines of the result:
101010011001100
0 1 1 1
0001111
0 0 0
0 1 1 1 1 1
000011110
0 0 1 1 1
0001100110
01010100110011
000111
000111100
001111l
00001111
Figure 14-1. Printing the array contents
Your entire printout is just a one-line array; the ones and zeros wrap
around when they meet the temporary right-margin that you set in
line 5.
This program shows how FOR-NEXT loops can use variables to
create patterns. The overall pattern gets made up of five sets of pattern
1,
four sets of 2, three sets of 3, . . . as shown in Figure
14-2.
Figure 14-2. Pattern sets
Before proceeding, delete line 5 and modify line
110
so that it prints
to the screen instead of to the printer:
110 FOR K=l TO C: PRINT A(K);: NEXT K:
PRINT'
.
PRINT "C =" C
191