Receiving from a Closed Channel
Let’s explore the behavior of a closed channel.
We'll cover the following
Reading from a closed channel returns the zero value of its data type. However, if we try to write to a closed channel, our program is going to crash in a bad way (panic).
Coding example
These two situations are explored in readCloseCh.go
and more specifically in the implementation of the main()
function:
Get hands-on with 1400+ tech skills courses.