最简单的一个遍历数组
for 随便起个名字 in
升级
上面的看不懂的话,这个应该会简单点
import UIKit let interestingNumbers = [ "prime": [2,3,5,6,11,13], "prime1": [1,1,2,3,5,8], "prime2": [1,4,9,16,25], ] var largest = 0 for (kind,numbers) in interestingNumbers { for number in numbers { if number > largest { largest = number } } } print(largest) ////////////////////////// let hehe = [1:[22,33],2:[12,32]] var xx = 0 for (name,array) in hehe { for number in array { print(number) } } //////////////////////// var intArray = [1,23,4,5] for int in intArray { print(int) }