Standard library / go/constant
go/constant.MakeImag()
Create a complex constant with zero real part and supplied imaginary component. Expected stdout: 'Complex 3\n'.
Formal Syntax & Structure
go syntaxgo
func MakeImag(x Value) ValueParameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | Value | Input constant or Go value as specified by the function. |
Return Value
Value
Create a complex constant with zero real part and supplied imaginary component.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/constant")
func main() { v := constant.MakeImag(constant.MakeInt64(3)); fmt.Println(v.Kind(), constant.Imag(v)) }