Skip to content

Glossary: Algorithms Beyond the Basics in Go

Comparable map keys

Also written: map key type

Map keys must be comparable with `==`: numbers, strings, bools, arrays and structs work, but slices don't. To key by two numbers, use a `[2]int` array or a small struct.

Where the book teaches it

Related terms

Memo mapComma-ok