PRACTICE / UNDERSTAND / REPEAT

Go: Iteration

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

15 questionsAnswers explainedFree · no login
Question 1 of 15
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.