Go lab

Go channels

Send, receive and close on buffered and unbuffered channels and see who blocks, and when.

InteractiveUnbuffered and buffered channels
Loading interactive…

An unbuffered channel is a hand-off: each send waits for its receive. A buffer lets the producer run ahead by up to cap values. After close, receives drain what is left and then return the zero value with ok == false; sending or closing again panics.

Learn the concept

The lesson this lab comes from, with the explanation, a practice task and a quiz.

More labs

All labs