Grokking Go
Vote

0% completed

​

Go - break Statement

The break statement in Go is used to terminate a loop immediately when a specific condition is met. Unlike continue, which skips only the current iteration, break completely exits the loop, preventing further iterations.

break is useful when you need to stop looping early once a condition is satisfied.

Syntax of the break Statement

for condition { if someCondition { break // Exits the loop immediately } // Code that executes only if break is not triggered }

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content