bufferedChan := make(chan string, 3)
Buffered channels work similar to unbuffered channels, but with one catch — we can send multiple pieces of data to the channel before needing another go routine to read from it.
Sent 1st Sent 2nd Sent 3rd
Note: Using buffered channels doesn’t prevent blocking from happening. For example, if the finding gopher is 10 times faster than the breaker, and they communicate through a buffered channel of size 2, the finding gopher will still block multiple times in the program.
capacity is 3 length is 2 read value: one new length is 1
Write your response...
Never miss a post from Gopher , when you sign up for Ednsquare.