A nil channel is a Go channel value with no associated channel resource. Sending to it or receiving from it blocks indefinitely, so later statements may never execute. If every goroutine becomes blocked, Go reports a deadlock. section 8.1.6
The useful pattern is disabling select cases. A send or receive involving a nil channel remains blocked, so select ignores that case while considering other ready cases. After an input channel closes, assigning nil to its variable prevents the closed-channel case from executing repeatedly. section 8.1.6
Combining sales and expenses
Two generator goroutines produce sales and expense amounts on separate channels. The receiving loop selects between them, adds sales, subtracts expenses, and sets a channel to nil when it reports no more data. The loop continues until both channel variables are nil, then prints the end-of-day profit or loss.
