11.07.2015 Views

Here - 1000 BiT

Here - 1000 BiT

Here - 1000 BiT

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

D^ INSTRUCTOR NOTES 30 ARRAYS AND THE DIM COMMAND^ This lesson introduces arrays. The DIM() statement is described. Up to 255 indices are^allowed.r*) Arrays with one index are described first. The array itself is compared to a family, andthe individual elements of the array to family members, with the index value being theO"first name" of the member.Two dimensional arrays can be compared to the numbers on a calendar month page or^ the rectangular array of cells on the TV screen.f*) Arrays themselves are not too difficult a concept. The trick is to see how they help inprogramming. There are a large variety of uses for arrays, and many do not seem to fall^ into recognizable catagories.One can use them to store lists of information. Connected lists also can occur. The^ telephone number program uses two linear arrays: one for names, the other for numbers.They are indexed the same, so a single index number can retrive both the name and ther*snumber which goes with it.^ Another general use of arrays is to store numbers which cannot neatly be obtained from^ an equation. An example would be the length in days of the 12 months.^ Games often use arrays to store information about the playing board.^If you forget to DIMension an array before use, the BASIC interpreter gives it a dimension of10. If you try to use an element larger than that assigned to the array, the^ ?BAD SUBSCRIPT ERROR IN XXr*) message is printed.QUESTIONS:^ 1. What does the DIM BD(6) statement do?r^ 2. Where do you put the DIM command in the program?(^ 3. What two kinds of array families are there?4. What is the "index" or "subscript" of an array?n169

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!