Gointrogo1
Maps and structs
Go's two everyday aggregate types.
A map is a hash table keyed by a comparable type; a struct groups named fields and can carry methods — together they model most of your data.
Map literal and comma-ok lookup
Gointro0ms
carol's age: 0bob: 25 found: truecarol found: false
Reference · output compiled offline, not runnable in-browser
Reading the absent key "carol" yields 0 (int's zero value) with no panic, while comma-ok returns found: true for "bob" and false for "carol" — that boolean is the only reliable way to tell a stored zero from a missing key.