Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Delete Map element

package main

import "fmt"

func main() {
	grades := map[string]int{
		"Mary": 99,
		"Jane": 88,
		"Bob":  93,
	}
	fmt.Printf("%T\n", grades) // map[string]int

	fmt.Println(grades) // map[Bob:93 Jane:88 Mary:99]

	delete(grades, "Jane")

	fmt.Println(grades) // map[Bob:93 Mary:99]
}