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

map of slices

package main

import (
	"fmt"
)

func main() {
	joeGrades := []int{2, 3, 4}
	fmt.Println(joeGrades)
	janeGrades := []int{7, 9, 5, 10}
	fmt.Println(janeGrades)

	people := make(map[string][]int)
	fmt.Println(people)
	people["joe"] = joeGrades
	people["jane"] = janeGrades
	fmt.Println(people)
}
[2 3 4]
[7 9 5 10]
map[]
map[jane:[7 9 5 10] joe:[2 3 4]]

add entry delete(map, name) delete entry