To find out how many items there are in a dictionary, use count. Type and run the following code:
// count returns the number of items in a dictionary
contactList.count
2 is displayed in the Results area.
You can check whether a dictionary is empty by using isEmpty. Type and run the following code:
// isEmpty returns true if a dictionary is empty
contactList.isEmpty
false is displayed in the Results area.
Now, let's see how to add new items to a dictionary.