0
在這裏,我試圖將不同的首都附加到他們的大陸地區。有人能告訴我我做錯了什麼嗎?在控制流中使用switch語句的問題。 Swift 3
var europeanCapitals: [String] = []
var asianCapitals: [String] = []
var otherCapitals: [String] = []
let world = [
"BEL": "Brussels",
"LIE": "Vaduz",
"BGR": "Sofia",
"USA": "Washington D.C.",
"MEX": "Mexico City",
"BRA": "Brasilia",
"IND": "New Delhi",
"VNM": "Hanoi"]
for (key, value) in world {
// Enter your code below
switch world {
case "BEL", "LIE", "BGR" : var europeanCapitals.append(value);
case "VNM", "IND" : var asianCapitals.append(value);
default: var otherCapitals.append(value);
}
// End code
}