Code: package main import "fmt" func main() { abc := []string{"aaa", "bbb", "ccc"} for i := range abc { fmt.Println(i) } for _, i := range abc { fmt.Println(i) } } Output: ~/tmp $ go run test.go 0 1 2 aaa bbb ccc