Standard library / reflect

reflect.Value.Complex()

Read a complex number as complex128; other kinds panic. Expected stdout: '(1+2i)\n'.

Formal Syntax & Structure

go syntaxgo
func (v Value) Complex() complex128

Return Value

complex128

Read a complex number as complex128; other kinds panic.

Working Example

Example Snippetgo
package main
import (  "fmt"  "reflect")
func main() { fmt.Println(reflect.ValueOf(complex64(1 + 2i)).Complex()) }
Go Reference