How to delete an element in map with Go

1 Answer

0 votes
package main

import "fmt"

func main() {
	m := make(map[string]int)

	m["abc"] = 123
	m["xyz"] = 800
	fmt.Println(m)
		
	delete(m, "abc")
	fmt.Println(m)
}



/*
run:

map[abc:123 xyz:800]
map[xyz:800]

*/

 



answered Mar 15, 2020 by avibootz

Related questions

1 answer 195 views
195 views asked Nov 4, 2020 by avibootz
1 answer 171 views
1 answer 157 views
1 answer 184 views
184 views asked Mar 15, 2020 by avibootz
1 answer 18 views
1 answer 71 views
...