// for in 循环
var sum = 0
for k in 1...10
{
sum = sum + k
}
print(sum)
for a in [1,2,3,4,5]
{
print(a)
}
print("----------->")
for k in [1:"1",2:"2",3:"3"]
{
print(k)
}
print("----------->")
for (a,b) in [1:"1",3:"3"]
{
print("元组=\(a,b)")
}
print("----------->")
// swift 好像不可以这样子了
// for a in "hello world"
// {
// print(a)
// }
原文链接:https://www.f2er.com/swift/322473.html