![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=1738978158-fmDJWM2U23rIhGZ99Kh5P0trk57GYJ0c-0-1f85902c026f806dc6e25e1097446f29)
We have successfully looked at how to loop through a dictionary.