GoMapdelete

Deletes the element with the specified key from the map.

Syntax

delete(m map[K]V, key K)

Example

Enter values below to update the example in real time.

map
string
fmt
Println
m := map[string]int{"a": 1, "b": 2}
delete(m, "a")
fmt.Println(m) // map[b:2]