In Go, we can create a map with a key of type complex using the map
keyword and the complex128
type as the key. Here's an example:
main.go183 chars15 lines
In this example, we create a new map by using make
and specifying the key as complex128
. We then create two complex numbers c1
and c2
and use them to set values in the map. We can then print out the entire map using fmt.Println(m)
.
gistlibby LogSnag