Re: [go-nuts] How Unbuffered channel work

2022-06-05 Thread Manjeet S
Thank you so much Aleksei Perevozov and Jan Mercl On Sunday, June 5, 2022 at 7:49:40 PM UTC+5:30 Jan Mercl wrote: > On Sun, Jun 5, 2022 at 4:06 PM Manjeet S wrote: > > > Can someone help me to understand why this code is not working. I'm > expecting that <-ch wait until we receive from channe

Re: [go-nuts] How Unbuffered channel work

2022-06-05 Thread Jan Mercl
On Sun, Jun 5, 2022 at 4:06 PM Manjeet S wrote: > Can someone help me to understand why this code is not working. I'm expecting > that <-ch wait until we receive from channel ch The range statement at line 18 does not complete unless the channel is closed. Adding `close(ch2)` at line 14 fixes t

[go-nuts] How Unbuffered channel work

2022-06-05 Thread Manjeet S
I just started to learn Go Language, and I'm enjoying writing code in Go. So today, I'm trying to understand how the unbuffered channel works Can someone help me to understand why this code is not working. I'm expecting that <-ch wait until we receive from channel ch func main() { ch := mak