Standard library / go/types

go/types.TypeAndValue.IsValue()

Reports whether the expression denotes a value. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (tv TypeAndValue) IsValue() bool

Return Value

bool

Reports whether the expression denotes a value.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/token"  "go/types")
func check(e error) {  if e != nil {    panic(e)  }}
func main() {  tv, e := types.Eval(token.NewFileSet(), nil, 0, "2+3")  check(e)  fmt.Println(tv.IsValue())}
Go Reference