package main
import(
"fmt"
)
func main(){
var ages map[string]int // Declaration 1
ages := make(map[string]int) // Declaration 2
ages["Ujjwal"] = 32
fmt.Println(ages)
}
While going through the book I came across this line “You must allocate the map before you can store into it.” . If we comment out Declaration 2 and run this code. we got a error “panic: assignment to entry in nil map” . And if we comment out declaration 1 then out code run smoothly. I am not able to understood this “You must allocate the map before you can store into it.” statement in the context of above code.