Maps
func main() {
m := make(map[string]int)
m["hello"] = 1
println(m["hello"])
}
Map Literal
func main() {
m := map[string]int {
"hello": 1,
"bye": 2,
}
}Delete
Removes the value
func main() {
m := map[string]int{
"hello": 1,
"bye": 2,
}
delete(m, "hello")
}Ok
Boolean saying if the value is present
func main() {
m := map[string]int{
"hello": 1,
"bye": 2,
}
//delete(m, "hello")
if ele, ok := m["hello"]; ok {
println(ele)
}
}