The range keyword iterates over collections. It returns both the index and value:
nums := []int{10, 20, 30}
for i, v := range nums {
fmt.Printf("Index %d: %d\n", i, v)
}
This prints each index with its value. Range works with arrays, slices, maps, strings, and channels. It's the idiomatic way to iterate in Go.