makeTable
makeTable(S_name[g_default_value] ) =>o_table
Description
Creates an empty association table.
Arguments
|
Default value to be returned when references are made to keys that are not in the table. If no default value is given, the system returns |
Value Returned
Examples
If you specify a default value when you create the table, the default value is returned if a nonexistent key is accessed.
myTable = makeTable("atable1" 0)
=> table:atable1
myTable[1]
=> 0
If you do not specify a default value when you create the table, the symbol unbound is returned if an undefined key is accessed.
myTable2 = makeTable("atable2")
=> table:atable2
myTable2[1]
=> unbound
You can refer to and set the contents of an association table with the standard syntax for accessing array elements
myTable[1] = "blue"
=> blue
myTable["two"] = '(r e d)
=> (r e d)
myTable['three] = 'green
=> green
myTable['three]
=> green
Related Topics
Return to top