Go - break statement
The wreck announcement in Go programming language has the subsequent usages
When a ruin statement is encountered inside a loop, the loop is right away terminated and this system manipulate resumes at the subsequent statement following the loop.
It can be used to terminate a case in a switch assertion.
SyntaxThe syntax for a ruin declaration in Go
bundle principal import "fmt" func primary() /* nearby variable definition */ var a int = 15 /* for loop execution */ for a < 25 fmt.Printf("value of a: %dn", a); a++; if a > 10 /* terminate the loop the use of wreck declaration */ destroy;When the above code is compiled and executed, it produces the subsequent result
$cross run principal.Pass value of a: 15