Standard library / go/constant

go/constant.Imag()

Obtain the imaginary component of a numeric constant. Expected stdout: '3\n'.

Formal Syntax & Structure

go syntaxgo
func Imag(x Value) Value

Parameters & Attributes

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

Return Value

Value

Obtain the imaginary component of a numeric constant.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/constant")
func main() { fmt.Println(constant.Imag(constant.MakeImag(constant.MakeInt64(3)))) }
Go Reference