【发布时间】:2020-03-12 12:11:50
【问题描述】:
struct _9table: View {
let digits: [Int] = [1,2,3,4,5,6,7,8,9]
var body: some View {
VStack{
ForEach(self.digits, id: \.self) { first in
ForEach(self.digits, id: \.self) { second in
if second > first {
Text("\(first)+\(second)=\(first+second)")
}
}
}
}
}
}
【问题讨论】:
-
let digits = [1,2,3,4,5,6,7,8,9]Swift 将推断类型无需编写或短let digits = (1...9) -
Sh_Khan 谢谢你的回答