https://hastebin.com/iyopexuqeq.cs
it is supposed to send output of the source channel to two other channels. While playing around with this code I noticed that sometimes, if you close done channel, only out1 or out2 gets the value, and other channel becomes nil
If we move <-done check outside of inner loop, both channels are guaranteed to either get value, or stay nil
My question is, is code given in the link considered a good practice and I don't understand some tricky channel interactions, or would moving moving case <-done outside the inner loop be a good idea?
What are you doing in #9 string in this code?
Обсуждают сегодня