Contents / Part 3 / Previous chapter / Next chapter / Index
Quite often we use the computer to store and manipulate sets of
data rather than just a single value. For example, we might want
to calculate wages for a group of people or sort a group of 20
numbers into order. The 20 numbers might well be associated with
20 names. Arrays make it a lot easier to deal with groups of
names and numbers. To get to a more manageable example let's
consider working with five names and their associated year of
birth. We could store the five names in five variables like
this: N1$ = "SARDESON" N2$ = "MATTINSON" N3$ = "MOIR" N4$ =
"ALLEN" N5$ = "MOUNT" That is quite reasonable and it works. If
you say the computer will then print out MATTINSON. However, you
cannot tell it to print out the 5th entry or the fourth entry.
The computer doesn't have any way of knowing that N5$ is the 5th
entry. Using arrays, though, we can pick out the 5th entry in a
long list and that is very useful. The first thing we have to do
is to tell the co