February 2011
Beginner
236 pages
4h 54m
English
One way of adding key/value pairs to a dictionary is the dict append command. The syntax is as follows:
dict append name key value…
In the following example, we will create a dictionary containing a set of key/value pairs and then append an additional set. Return values from the commands are provided for clarity. Enter the following command:
% set names [dict create 1 John 2 Mary 3 Paul]
1 John 2 Mary 3 Paul
% dict append names 4 Fred
1 John 2 Mary 3 Paul 4 Fred
The dict append command appends a key and value pair (or pairs) to the dictionary referenced by name.
Read now
Unlock full access