swift 遍历

时间:2021-06-14 21:10:11

最简单的一个遍历数组

for 随便起个名字 in

swift 遍历

升级

swift 遍历

上面的看不懂的话,这个应该会简单点

swift 遍历

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)
}