I saw this question that for correct answer had 'for and range'.
But the for statement is the only available looping statement in Go,and the range keyword allows you to iterate over items of a list like an array or a map. For understanding it, you could translate the range keyword to for each index of.
//for loop
package main
import "fmt"
func main() {
for i := 0; i < 5; i++ {
fmt.Println("Value of i is now:", i)
}
}
//range is used inside a for loop
a := [...]string{"a", "b", "c", "d"}
for i := range a {
fmt.Println("Array item", i, "is", a[i])
}
capitals := map[string] string {"France":"Paris", "Italy":"Rome", "Japan":"Tokyo" }
for key := range capitals {
fmt.Println("Map item: Capital of", key, "is", capitals[key])
}
//range can also return two items, the index/key and the corresponding value
for key2, val := range capitals {
fmt.Println("Map item: Capital of", key2, "is", val)
}