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 285 views
285 views asked Nov 4, 2020 by avibootz
1 answer 266 views
1 answer 261 views
1 answer 274 views
274 views asked Mar 15, 2020 by avibootz
1 answer 130 views
...