Standard library / go/types

go/types.NewTerm()

Creates a union term; tilde means types with the specified underlying type. Expected stdout: '~int\n'.

Formal Syntax & Structure

go syntaxgo
func NewTerm(tilde bool, typ Type) *Term

Parameters & Attributes

NameTypeDescription
tildeboolInput to the operation as described above.
typTypeType associated with the object or value.

Return Value

*Term

Creates a union term; tilde means types with the specified underlying type.

Working Example

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