Curriculum Types & methods Nil & zero values exercise 7 · mcq
Nil & zero values
Exercise 5 showed a nil SLICE is fully usable for append.
What about a nil MAP? Given:
``go
var m map[string]int
`
…pick the line that correctly describes what happens for each
operation on m`.
TypeScript reference
About this theme
Every type has a zero value — what an uninitialised variable of that type holds. For numbers: 0. For strings: "". For bools: false. For pointers, interfaces, maps, slices, channels, and functions: nil. nil is *not* TypeScript's undefined — it's a typed absence, and conflating "nil pointer" with "nil interface" is one of the classic Go bugs.