Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

panic: assignment to entry in nil map

// panic: assignment to entry in nil map
var m map[string]float64
m["pi"] = 3.1416

// You need to init map with "make" function
m := make(map[string]float64)

// Answer from https://yourbasic.org/golang/gotcha-assignment-entry-nil-map/
 
PREVIOUS NEXT
Tagged: #assignment #entry #nil #map
ADD COMMENT
Topic
Name
3+3 =