Check out example codes for "go iterate over slice". It will help you in understanding the concepts better.

Code Example 1

var slice = []string{"Apple", "Orange", "Kiwi"}
for index, sliceItem := range slice { // You can omit index or sliceItem with a _
  fmt.Println("Index in slice:", index)
  fmt.Println("Fruit:", sliceItem)
}

Code Example 2

nums := []int{2, 3, 4}
    sum := 0
    for _, num := range nums {
        sum += num
    }
    fmt.Println("sum:", sum)

Learn ReactJs, React Native from akashmittal.com