Predeclared identifier
Go nil identifier
Represents the zero value of pointer, function, slice, map, channel and interface types. It is not a constant and has no default type. A non-nil interface may contain a nil pointer. Example output: 'true false'.
Formal Syntax & Structure
go syntaxgo
nilWorking Example
Example Snippetgo
package main
import ( "fmt")
func main() { var p *int var x any = p fmt.Println(p == nil, x == nil)}