3 ms·
No it will not, and can not. "c <- num" is a blocking statement. Since c is an unbuffered channel, execution cannot proceed past the statement until a reader c
by sirclueless 11y ago
No it will not, and can not.
"c <- num" is a blocking statement. Since c is an unbuffered channel, execution cannot proceed past the statement until a reader consumes a value. The reader in this case creates 10 goroutines executing "c <- num" and only then starts consuming values. If the statements you wrote were inlined execution would immediately halt in a deadlock.