Type semantics

Interface dynamic types and values

A nonnil interface carries a dynamic type and dynamic value. An interface holding a typed nil pointer is not itself nil. Comparing interfaces with identical uncomparable dynamic types can panic. Example output: 'false true'.

Formal Syntax & Structure

go syntaxgo
var x any = concreteValue

Working Example

Example Snippetgo
package main
import "fmt"
func main() {  var p *int  var x any = p  fmt.Println(x == nil, p == nil)}
Go Reference