iOS 12 Programming for Beginners
上QQ阅读APP看书,第一时间看更新

Dictionaries

A dictionary is an unordered collection of values, with each one accessed through a unique key. Let's look at the following diagram:

In our diagram, we have a dictionary of pizzas (keys) with their prices (values). To find something inside a dictionary, we must look it up according to its key. Let's look at a dictionary syntax:

Dictionary<Key, Value>

Now, that we understand what a dictionary is and its syntax let's look at how we can use it by creating our first dictionary.