- iOS 12 Programming for Beginners
- Craig Clayton
- 54字
- 2025-02-28 11:21:49
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.