james-l
2/11/2017 - 10:17 PM

go function expression go匿名函数

go function expression go匿名函数

// write the function with a name first
// then delete the fun name, and assign to a variable
func main() {
	foobar := func() {
		fmt.Println("foobar")
	}

	foobar()
}