Skip to content

Instantly share code, notes, and snippets.

@msehnout
Last active December 23, 2019 09:01
Show Gist options
  • Save msehnout/7ad3c0c35b85b52f1452b23cb145d732 to your computer and use it in GitHub Desktop.
Save msehnout/7ad3c0c35b85b52f1452b23cb145d732 to your computer and use it in GitHub Desktop.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment