Overview In this blog I am going to talk about the topic below. Loop break continue infinity collection Panic Switches Loop You can use loop as below. here i variable is declared inside the loop so the value will be valid in side the loop. Example package main import ( "fmt" ) func main() { for i:=0;i<5;i++{ fmt.Println(i) } } output : 0 1 2 3 4 5 Break in Loop what Break statement dose is it will break out from the loop. package main import ( "fmt" ) func main() { for i:=0;i<5;i++{ fmt.Println(i) if i==2 { break } } ...