Go

Typed Nil Is Not Nil in Go

GoInterfacesNil Interfacesadvanced

An interface holds a type and a value. A nil pointer stored in an interface makes the interface non-nil, a classic source of broken error checks.

expected output

true false

Why practise typing this

Typing interfaces code builds muscle memory for the symbols and indentation Go uses most, which prose-based typing tests never cover. DevType measures your words per minute and accuracy on this snippet and tracks the individual characters you mistype, so later lessons can target them.

More Go practice

Browse all Go snippets →