![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=1739598288-v5DR8mG6lrKFGHGrjkQsgx1zabD4i9PC-0-cc6a2be2ad8d0833bf5926b73d0f010f)
We have successfully looked at how to loop through a dictionary.