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 207 views
207 views asked Nov 4, 2020 by avibootz
1 answer 179 views
1 answer 170 views
1 answer 196 views
196 views asked Mar 15, 2020 by avibootz
1 answer 40 views
1 answer 84 views
...