Iteration and Enumeration
for <identifier> in <array> {
<instructions to execute>
}let myStrings = ["a", "b", "c"]
for (index, i) in myStrings.enumerated() {
print(index, i)
}
// 0 a
// 1 b
// 2 cLast updated
Was this helpful?
for <identifier> in <array> {
<instructions to execute>
}let myStrings = ["a", "b", "c"]
for (index, i) in myStrings.enumerated() {
print(index, i)
}
// 0 a
// 1 b
// 2 cLast updated
Was this helpful?
Was this helpful?