News flash: I'm going to Australia in February, so this Web site may be switched off at any time.


Retrieving items from an Icon table

Once you have stored a value v into a table t using key k, you can retrieve the stored value using this expression:

    t[k]
For example, if the variable ``today'' contains the three-letter string for the day of the week, and you have a table ``dayNumbers'' set up as shown in the previous page (see storing items in an Icon table), the expression
    dayNumbers[today]
will return the value stored under that key. If ``today'' is the string "Tue", the expression ``dayNumbers[today]'' will produce the integer 3.
Next: Testing an Icon table for the presence of a key
See also: Using the Icon programming language
Previous: Storing items in an Icon table

John W. Shipman, john@nmt.edu