Source file tour/moretypes/mutating-maps.go
1 //go:build OMIT 2 3 package main 4 5 import "fmt" 6 7 func main() { 8 m := make(map[string]int) 9 10 m["Answer"] = 42 11 fmt.Println("The value:", m["Answer"]) 12 13 m["Answer"] = 48 14 fmt.Println("The value:", m["Answer"]) 15 16 delete(m, "Answer") 17 fmt.Println("The value:", m["Answer"]) 18 19 v, ok := m["Answer"] 20 fmt.Println("The value:", v, "Present?", ok) 21 } 22