![iOS 12 Programming for Beginners](https://wfqqreader-1252317822.image.myqcloud.com/cover/76/36699076/b_36699076.jpg)
上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:
![](https://epubservercos.yuewen.com/2E52D1/19470383901517806/epubprivate/OEBPS/Images/f5ea8ae8-719d-4f9a-8ce4-3bd2198ced41.png?sign=1739485717-bOzIJ9UAE0c35OzoO737YyCe76oXlJ8K-0-152c4e0f5f99b0a8d8ea78608f1e5067)
We have successfully looked at how to loop through a dictionary.