Standard library / go/constant
go/constant.ToComplex()
Convert a representable numeric constant to Complex, otherwise Unknown. Expected stdout: 'Complex\n'.
Formal Syntax & Structure
go syntaxgo
func ToComplex(x Value) ValueParameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | Value | Input constant or Go value as specified by the function. |
Return Value
Value
Convert a representable numeric constant to Complex, otherwise Unknown.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/constant")
func main() { fmt.Println(constant.ToComplex(constant.MakeInt64(42)).Kind()) }