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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.186.173