//for-in
/*
for 迭代变量 in集合变量
{
使用迭代变量便利所有数据
}
*/
//遍历数组
var arr = ["a","b","c","d"]
for tempin arr
{
print(temp)
print("\t")
}
//
var array:[(String,Int,String)] = [("张三",20,"男"),("王三",30,("张浩",50,"女")]
for vin arr
{
if v.0 =="王三" {
print(v)
break
}
}
原文链接:https://www.f2er.com/swift/326295.html