Answers for "for loop in go lang"

Go
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

for loop golang

for i := 0; i < 10; i++ {
  fmt.Println(i)
}
Posted by: Guest on September-30-2021

Browse Popular Code Answers by Language