如何使用for循环的值。这是示例代码。我可以返回所有名称吗?
func getResult() -> String {
var x = ""
let names = ["Arthur", "Zaphod", "Trillian", "Ford", "Marvin"]
for name in names {
x = name
}
return x
}
这是另一个示例代码
func getResults() -> String {
var row = ""
let exerciseType = try! self.database.prepare(self.exerciseTable)
for types in exerciseType {
row = types[self.type]
}
return row
}