Cold Help System: Programming: ColdC Reference Manual: Language Structure: Data Types: Dictionary


A dictionary is a collection of data associations, each of which has a key and a value. Dictionaries are similar to lists, however, lookup in a dictionary is with the key (returning the value), rather than with the location in the list. Dictionaries generally take up more storage space in memory than lists, and are slightly slower to add to and remove from than lists, but searching for items in dictionaries is much faster than searching for items in a list.

Dictionaries are denoted by a list of two-element lists, preceded with a hash mark (#). Each of the two-element lists is an association, where the first element is the key and the second element is the value. Dictionaries are logically true unless empty. The following are all valid dictionaries:

#[["foo", 3], ['bar, 'baz]]
#[["something", 'blue], ["one", 1], ["two", 2]]

When evaluating the key for the value in the dictionary is indexed, rather than the position as in a list, such as:

dict=#[["foo", 3], ['bar, 'baz]];
dict['bar];
=> 'baz

See Also: Dictionary Functions


Integer | Float | String | Symbol | List | Object Number | Dictionary | Error Codes | Frob | Buffer


the Cold Dark