for in 循环是比较常用的循环结构,常用在遍历当中,下面是它一些简单的用法。
// for in 循环可以加区间
for a in 1...5 {
print(a)
}
// 遍历数组
for b in ["a", "b", "c", "d"] {
print(b)
}
// 遍历字典
for (c,d) in ["adress":"广州","company":"公司"] {
print("\(c):\(d)")
}
for e in ["adress":"广州","company":"公司"] {
print(e)
}