Skip to content

Instantly share code, notes, and snippets.

@snachx
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snachx/ba214c6c6629e5f4c38a to your computer and use it in GitHub Desktop.
Save snachx/ba214c6c6629e5f4c38a to your computer and use it in GitHub Desktop.
package main
import "fmt"
func main() {
var fs []func() int
for i := 0; i < 3; i++ {
fs = append(fs, func() int {
return i
})
}
for _, f := range fs {
fmt.Printf("%p = %v\n", f, f())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment