Three syntactical elements that return 2 values
golang supports multiple return values from functions but there are also 3 different syntactical elements or accessors that also return 2 values.
The most straight forward is accessing values from a map.
Type assertions also want to let you know that they're ok
, like when we try to assert an error as a json.SyntaxError
. Yeah, its a SyntaxError, ok?
Channels can also let the program that things are going ok
when using the receive syntax <-
.