...

/

Puzzle 16 Explanation: Channel Capacity

Puzzle 16 Explanation: Channel Capacity

Understand how channels work in Go.

We'll cover the following...

Try it yourself

Try executing the code below to see the result.

Press + to interact
package main
import (
"fmt"
)
func main() {
ch := make(chan int, 2)
ch <- 1
ch <- 2
<-ch
close(ch)
a := <-ch
b := <-ch
fmt.Println(a, b)
}

Explanation

The ch channel is a buffered channel with a capacity of ...

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