Anonymous functions assigned to name
package main
import "fmt"
func main() {
f := func() {
fmt.Println("Hello Anonymous!")
}
fmt.Println("Start")
f()
fmt.Println("End")
fmt.Printf("%T", f)
}
Start
Hello Anonymous!
End
func()
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
package main
import "fmt"
func main() {
f := func() {
fmt.Println("Hello Anonymous!")
}
fmt.Println("Start")
f()
fmt.Println("End")
fmt.Printf("%T", f)
}
Start
Hello Anonymous!
End
func()