You can make city
mutable by adding var
to its declaration:
for (country, var city) in countries {
Unfortunately, changing it won't affect your countries
Dictionary, because you're getting a copy of each sub-Dictionary. To do what you want, you'll need to loop through the keys of countries
and change things from there:
for country in countries.keys {
if countries[country]!["London"] != nil {
countries[country]!["London"]! = "Picadilly Circus"
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…