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]