Go by Example - Closures
Go by Example
Go is an open source programming language designed for building simple, fast, and reliable software.
Go by Example is a hands-on introduction to Go using annotated example programs. Check out the first example or browse the full list below.
Go by Example: Closures
golang支持匿名函数,可以用来构建闭包。当你需要定一个不需要命名的内连函数时匿名函数很有用。
1 | package main |
1 | $ go run closures.go |