Feb 252013
 

12 And it came to pass, when Ben-hadad heard this message, as he was drinking, he and the kings in the pavilions, that he said unto his servants, Set yourselves in array. And they set themselves in array against the city.

So, what did the soldiers look like once they had arrayed themselves? Arrays are an extremely useful construct in programming. They allow us to group items together in lists. Lists are all around us.  For example, a grocery list: eggs, milk, butter, cheese, yogurt, etc..  We can see a physical example of an array even with one item on this list. Look at the eggs, all arrayed in white! (sounds scriptural, doesn’t it?)

carton of eggs

A carton of eggs is an array

An array at it’s simplest is referred to as an indexed array. For each item, there is a value. This would be like a numbered list. Be careful as you consider the index of an array as some indexes start at 0 and others start at 1. Typically, this depends on the language.

Another example might be a list of people and their birthdays.  For example:

  • Peter: 4 April 1978
  • Robert: 6 July 1968
  • Jen: 2 November 1973
  • Ammon: 23 November 1956
  • Mike: 20 July 1984
  • Pam: 11 June 1981
  • Vera:

There are more complex arrays, too.  Imagine having an array within an array.  We could see this on an album of songs:

An album list is an array of arrays

 

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)