是否有一个函数可以用于遍历数组并同时具有索引和元素,比如Python的enumerate
for index, element in enumerate(list):
...发布于 2019-05-20 15:46:47
对于您想要做的事情,应该在您的enumerated()阵列上使用方法
for (index, element) in list.enumerated() {
print("\(index) - \(element)")
}https://stackoverflow.com/questions/24028421
复制相似问题