最简单的一个遍历数组
for 随便起个名字 in
升级
上面的看不懂的话,这个应该会简单点
import UIKit
let interestingNumbers = [
"prime": [,,,,,],
"prime1": [,,,,,],
"prime2": [,,,,],
]
var largest =
for (kind,numbers) in interestingNumbers {
for number in numbers {
if number > largest {
largest = number
}
}
}
print(largest) //////////////////////////
let hehe = [:[,],:[,]]
var xx =
for (name,array) in hehe {
for number in array {
print(number)
}
}
//////////////////////// var intArray = [,,,]
for int in intArray {
print(int)
}