Overview
Syllabus
Intro
welcome every single one of you
nil is (a) zero
interlude a bit of history
zero values what are they?
the type of nil
nil is a predeclared identifier representing the zero value for a pointer, channel, func, interface, map, or slice type.
zero values what do they mean?
type, value
when is nil not nil?
do not declare concrete error vars
do not return concrete error types
nil receivers are useful
use nil slices they're often fast enough
use nil maps as read-only empty maps
coding time
can we switch off a chan?
use nil chans to disable a select case
'nil values can satisfy interfaces
use nil interfaces to signal default
nil is useful
Taught by
Gopher Academy