Sunday, April 11, 2010

Workshop 4

Arrays

Arrays can also be created using a key/value pair combination. These are often referred to as associative arrays or hashes. In a hash each value is associated with a unique key. Unlike list arrays that use a number as an index value, associative arrays use any value. The easiest way to comprehend how a hash works is to think of it as a table. In the following table the state name serves to role as key and the city is the value.

State (key)

City (value)

Victoria

Melbourne

NSW

Sydney

South Australia

Adelaide

Queensland

Brisbane

Tasmania

Hobart

Test Code

1 comment:

  1. This workshop shows a perfect practical guidance about array program. Well Done Kunal!

    ReplyDelete