You may also wonder why the program prints not only the different pin patterns but also the character “J” a number of times. The reason lies in the number of columns you reserved with the graphics command. After the LX-86 receives all the numbers reserved by a graphics command-50 in this case-it leaves the graphics mode and resumes interpreting numbers as printable characters or print com- mands.

Since the incorrect program has sent many extra numbers, mainly 10s and 13s, the 50 columns reserved are filled before the loop in line 40 has been executed 50 times. Therefore, during the last passes of the loop the Ix-86 interprets CHR$(74) as the ASCII code for “J” and prints that character each of the last 35 passes of the loop.

If you want to make the program work correctly, put the line- spacing command in line 10, delete line 30, and add two semicolons: one at the end of line 20 and one between CHR$(74) and the colon in line 40.

We have explained this incorrect program in detail so that you will remember two important tips about using the graphics command:

Use semicolons to prevent the LX-86 from printing carriage re- turn and line feed codes as pin patterns.

Do not put any other commands between the graphics command and its data.

Our example should help you understand the graphics mode better and may help you find the problem when one of your own programs gives you unexpected results.

String variables

In a long and complicated graphics program, typing in the graphics command or repetitive data numbers over and over can become time- consuming. You can avoid much of the repetitive typing by storing commands and data in string variables.

Look at the program below. It is the same as the multiple-line exercise earlier in the chapter except for the string variables.

86