
上QQ阅读APP看书,第一时间看更新
Iterating over dictionary keys and values
When you need to iterate over both dictionary keys and values using a for...in loop, you use the following:
for (key, value) in dictPizzas { print("\(key): \(value)") }
Your code and output should now look like this:

We have successfully looked at how to loop through a dictionary.