Go (programming language) - Go Loops - Go Break Statement - Go (programming language)

What is a break statement in Go programming language?

The Go programming language break statement has the following uses:

  1. When the break statement is encountered inside a loop, the loop is immediately terminated and program control resumes at the next statement following the loop.
  2. It can be used to terminate a case in the switch statement.

If nested loops are used, the execution of the innermost loop is stopped by the break statement and the next line of code after the block start executing.


The syntax for a break statement in Go is as follows:

Flow Diagram

Go break Statement


When the above code is compiled and executed, the result produced appears as -

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Go (programming language) Topics