won't need those REM statements anymore and you can save quite a bit of space by removing the REM statements. If you plan to revise or study the program structure in the future, it's a good idea to keep a copy on file with the REM statements intact.
If a number, word or sentence is used repeatedly in your program it's usually best to define those long words or numbers with a one or two letter variable. Numbers can be defined as single letters. Words and sentences can be defined as string variables using a letter and dollar sign. Here's one example:
| BEFORE CRUNCHING: | AFTER CRUNCHING: |
|---|---|
10 POKE 54296,15 20 POKE 54276,33 30 POKE 54273,10 40 POKE 54273,40 50 POKE 54273,70 60 POKE 54296,0 | 10 V=54296:F=54273 20 POKEV,15:POKE54276,33 30 POKEF,10:POKEF,40:POKEF,70 40 POKEV,0 |
Large amounts of data can be typed in as one piece of data at a time, over and over again ... or you can print the instructional part of the program ONCE and print all the data to be handled in a long running list called the DATA statement. This is especially good for crowding large lists of numbers into a program.
Arrays and matrices are similar to DATA statements in that long amounts of data can be handled as a list, with the data handling portion of the program drawing from that list, in sequence. Arrays differ in that the list can be multi-dimensional
One of the easiest ways to reduce the size of your program is to eliminate all the spaces. Although we often include spaces in sample
| This page has been created by Sami Rautiainen. | |
| Read the small print. | Last updated December 22, 2002. |