//创建数组
var nameArr:[String]=[“111”,“222”,“3333”,“4444”]
//采用for in 进行遍历
for na in nameArr{
print(na)
}
//创建数组
var nameArr:[String]=["111","222","3333","4444"]
//采用for in 进行遍历
for na in nameArr{
print(na)
}
//下表方式遍历
print(nameArr[0..<(nameArr.count)])
//1、 创建一个字典,内容key为学习小组成员名,value值为学习小组成员成绩,用for-in循环遍历字典中key, 用for-in循环遍历字典中value,用for-in循环同时遍历字典key和value
var Dic:[String:Int]?=["1":100,"2":50,"3":80]
for key in (Dic?.keys)!{
print("我是key:\(key)")
}
for valus in (Dic?.values)!{
print("我是valus:\(valus)")
}