The clear function that you saw in “Emptying a Slice” works on maps also. A cleared map has its length set to zero, unlike a cleared slice. The following code:
m := map[string]int{
"hello": 5,
"world": 10,
}
fmt.Println(m, len(m))
clear(m)
fmt.Println(m, len(m))
prints out:
map[hello:5 world:10] 2
map[] 0
Progress is saved on this device.