go for code example
Example 1: go for loop
package main
import "fmt"
func main() {
sum := 0
for i := 0; i < 10; i++ {
sum += i
}
fmt.Println(sum)
}
Example 2: go for loop
sum := 0
for i := 1; i < 5; i++ {
sum += i
}
fmt.Println(sum) // 10 (1+2+3+4)
Example 3: golang for
for i, s := range arr {
}
for k,v := range map{
}
for{
break
}