The break statement immediately exits the loop:
for i := 0; i < 10; i++ {
if i == 5 {
break
}
fmt.Println(i)
}
This prints through . When i equals , break exits the loop entirely. Code after the loop continues normally. Use break when you find what you're looking for.