Welcome to the Treehouse Community
Looking to learn something new?
Ashley Boucher407 Points
On Inserting Key Value Pairs
Why does the code
airportCodes.updateValue("Dublin Airport", forKey: "DUB")
produce "nil" in the results area?
Michael Hulet47,842 Points
The results pane shows what every function
updateValue(forKey:) method returns an optional value of the last value for that key in the dictionary, like this:
let dict = ["Key": "Value"] dict.updateValue("Lock", forKey: "Key") //"Value" will show in results
In this case, there was no value for the key
"DUB" in that dictionary (or it was nil), so it had nothing to
return, and so it