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=1 TO C: LPRINT A(K);: NEXT K: LPRINT: LPRINT "C="C

and RUN your growing program. Figure 14-1shows the first seven lines of the result:

Figure 14-1. Printing the array contents

Your entire printout s 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=1 TO C: PRINT A(K);: NEXT K: PRINT' PRINT "C = "C

191