WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Go - break statement


The break 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.

Syntax

The syntax for a ruin declaration in Go
break ;

Example

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 break  declaration */
         destroy;
      
   

When the above code is compiled and executed, it produces the subsequent result
$cross run principal.Pass
value of a: 15