Standard library / go/constant

go/constant.Int64Val()

Extract int64 and exactness flag; ignore the numeric result if the flag is false. Expected stdout: '42 true\n'.

Formal Syntax & Structure

go syntaxgo
func Int64Val(x Value) (int64, bool)

Parameters & Attributes

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

Return Value

(int64, bool)

Extract int64 and exactness flag; ignore the numeric result if the flag is false.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/constant")
func main() { v, ok := constant.Int64Val(constant.MakeInt64(42)); fmt.Println(v, ok) }
Go Reference