PRACTICE / UNDERSTAND / REPEAT
Go practice question
Practice control flow with self-contained questions. Check your answer, then use the explanation to understand the reasoning.
1 questionAnswers explainedFree · no login
Try this question
What sum does this Go for loop print?
total := 0
for i := 1; i <= 1; i++ { total += i }
fmt.Println(total)
Answer & explanation
Answer: 1
The loop adds all integers from 1 through n.