Function semantics
Nil function values
Function values have nil as their zero value. They may be compared to nil but not to another function value. Invoking nil panics; guard optional callbacks or provide a default. Example output: 'true\nfalse'.
Formal Syntax & Structure
go syntaxgo
var f func()Working Example
Example Snippetgo
package main
import "fmt"
func main() { var f func() fmt.Println(f == nil) f = func() {} fmt.Println(f == nil)}