let array = [1,3,4,5,"",78,9,10] as [Any]@H_403_47@
@H_403_47@
for i in array {@H_403_47@
print("元素=\(i)")@H_403_47@
}@H_403_47@
@H_403_47@
@H_403_47@
// EnumeratedSequence@H_403_47@
// 'enumerate' is unavailable: call the 'enumerate()' method on the sequence@H_403_47@
// for (index,value) in EnumeratedSequence(array)@H_403_47@
// {@H_403_47@
// // 这样子遍历,可以得到数组的值和下标@H_403_47@
// print("index:\(index) = \(value)")@H_403_47@
// }@H_403_47@
@H_403_47@
@H_403_47@
for (index,value) in array.enumerated()@H_403_47@
{@H_403_47@
// 这样子遍历,可以得到数组的值和下标@H_403_47@
print("index:\(index) = \(value)")@H_403_47@
}@H_403_47@ 原文链接:https://www.f2er.com/swift/322489.html