Standard library / go/constant

go/constant.BoolVal()

Extract a boolean constant; Unknown yields false. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func BoolVal(x Value) bool

Parameters & Attributes

NameTypeDescription
xValueInput constant or Go value as specified by the function.

Return Value

bool

Extract a boolean constant; Unknown yields false.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/constant")
func main() { fmt.Println(constant.BoolVal(constant.MakeBool(true))) }
Go Reference