Files
the-way-to-go_ZH_CN/eBook/examples/chapter_6/function_literal.go
2015-03-03 12:25:25 -05:00

16 lines
219 B
Go

package main
import "fmt"
func main() {
f()
}
func f() {
for i := 0; i < 4; i++ {
g := func(i int) { fmt.Printf("%d ", i) }
g(i)
fmt.Printf(" - g is of type %T and has value %v\n", g, g)
}
}