我在操场上制作的这段代码代表了我的问题:
import Foundation
var countries = ["Poland":["Warsaw":"foo"],"England":["London":"foo"]]
for (country, city) in countries {
if city["London"] != nil {
city["London"] = "Piccadilly Circus" // error because by default the variables [country and city] are constants (let)
}
}
Run Code Online (Sandbox Code Playgroud)
有没有人知道一项工作或最好的方法来使这项工作?
swift ×1