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


Storing items in an Icon table

To store value v into an Icon table named t under the key value k:

    t[k]  :=  v;
For example, this code sets up a table for translating the three-letter string for the day of the week to a number:
    dayNumbers  :=  table ( );     # Create the table
    dayNumbers["Sun"]  :=  1;
    dayNumbers["Mon"]  :=  2;
    dayNumbers["Tue"]  :=  3;
    dayNumbers["Wed"]  :=  4;
    dayNumbers["Thu"]  :=  5;
    dayNumbers["Fri"]  :=  6;
    dayNumbers["Sat"]  :=  7;

Next: Retrieving items from an Icon table
See also: Using the Icon programming language
Previous: Creating an Icon table

John W. Shipman, john@nmt.edu