Standard library / go/constant
go/constant.Val()
Expose the underlying representation: bool, string, int64, *big.Int, *big.Rat or *big.Float. Complex and Unknown yield nil. Expected stdout: 'int64\n'.
Formal Syntax & Structure
go syntaxgo
func Val(x Value) anyParameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | Value | Input constant or Go value as specified by the function. |
Return Value
any
Expose the underlying representation: bool, string, int64, *big.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/constant")
func main() { fmt.Printf("%T\n", constant.Val(constant.MakeInt64(42))) }