iOS ● ○ ○ Swift 6

Kodebits Day 97: Enumerated Loop

Sep 23 2026
Practice loops with a short swift challenge.

What is the output?

let items = ["A", "B", "C"]
for (i, v) in items.enumerated() {
  print("\(i):\(v)")
}


Try it in the online Swift Playground →

[spoiler title="Solution"]

Answer:

0:A
1:B
2:C

Explanation:

enumerated provides both index and value when iterating collections.

[/spoiler]


Further Reading