Maps / Delete from a map / Essential Go

Run Settings
LanguageGo
Language Version
Run Command
package main import ( "fmt" ) func main() { people := map[string]int{"john": 30, "jane": 29} fmt.Printf("%v\n", people) // deleting a key that doesn't exist is a no-op delete(people, "notfound") fmt.Printf("%v\n", people) // deleting a key in nil map is a no-op var something map[string]int delete(something, "notfound") }
Editor Settings
Theme
Key bindings
Full width
Lines