Answers for "Go lang for loop"

Go
4

golang loop

package main

import "fmt"

func main() {
	sum := 0
	for i := 0; i < 10; i++ {
		sum += i
	}
	fmt.Println(sum)
}
Posted by: Guest on March-26-2020
2

go for loop

sum := 0
for i := 1; i < 5; i++ {
    sum += i
}
fmt.Println(sum) // 10 (1+2+3+4)
Posted by: Guest on August-19-2020
0

golang for

for i, s := range arr {
}
for k,v := range map{
}
for{
 break
}
Posted by: Guest on April-23-2021

Browse Popular Code Answers by Language