Predeclared type

Go any type

Alias of interface{}. Any ordinary value can be assigned to it; operations are limited by its static interface type unless a type assertion or type switch is used. Introduced in Go 1.18. Example output: '42 true'.

Formal Syntax & Structure

go syntaxgo
any

Working Example

Example Snippetgo
package main
import (  "fmt")
func main() {  var value any = 42  n, ok := value.(int)  fmt.Println(n, ok)}
Go Reference