Answers for "golang range"

Go
1

go iterate over slice

nums := []int{2, 3, 4}
    sum := 0
    for _, num := range nums {
        sum += num
    }
    fmt.Println("sum:", sum)
Posted by: Guest on July-30-2020

Browse Popular Code Answers by Language