...

/

Channels

Channels

This lesson explains in detail the workings of channels in Go

About channels

Channels are pipes through which you can send and receive values using the channel operator, <-.

Press + to interact
ch <- v // Send v to channel ch.
v := <-ch // Receive from ch, and
// assign value to v.

(The data flows in the direction of the arrow.)

Like maps and slices, channels must be created before use:

Press + to interact
ch := make(chan int)

By default, sends and receives block wait until the other side ...

Access this course and 1400+ top-rated courses and projects.