在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
最简单的一个遍历数组 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) }
|
请发表评论