Standard library / go/types

go/types.Term.Type()

Returns the type in the term. Expected stdout: 'int\n'.

Formal Syntax & Structure

go syntaxgo
func (t *Term) Type() Type

Return Value

Type

Returns the type in the term.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/types")
func term() *types.Term { return types.NewTerm(true, types.Typ[types.Int]) }
func main() { v := term(); fmt.Println(v.Type()) }
Go Reference