- iOS 12 Programming for Beginners
- Craig Clayton
- 54字
- 2021-07-02 15:05:03
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.