PRACTICE / UNDERSTAND / REPEAT

Go practice question

Practice iteration with self-contained questions. Check your answer, then use the explanation to understand the reasoning.

1 questionAnswers explainedFree · no login

Try this question

Iteration · Code recallQuestion link ↗

Complete the keyword that exposes index and value for a slice.

for index, value := ___ values {
    fmt.Println(index, value)
}
Answer & explanation

Answer: range

The `range` clause yields the index and element for a slice.