parent
cf6b1fe44a
commit
c4b8ffdd62
@ -18,8 +18,7 @@ func main() {
|
||||
// This `range` iterates over each element as it's
|
||||
// received from `queue`. Because we `close`d the
|
||||
// channel above, the iteration terminates after
|
||||
// receiving the 2 elements. If we didn't `close` it
|
||||
// we'd block on a 3rd receive in the loop.
|
||||
// receiving the 2 elements.
|
||||
for elem := range queue {
|
||||
fmt.Println(elem)
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
e415b1f2ae531b319bb9aca69b17e7b916511744
|
||||
WN7NNh9tvh
|
||||
8b5d8a77e84c34771c5b14af014ecef3f88b2a6c
|
||||
I63ge2ISDs
|
||||
|
@ -42,7 +42,7 @@ values received from a channel.</p>
|
||||
|
||||
</td>
|
||||
<td class="code leading">
|
||||
<a href="http://play.golang.org/p/WN7NNh9tvh"><img title="Run code" src="play.png" class="run" /></a>
|
||||
<a href="http://play.golang.org/p/I63ge2ISDs"><img title="Run code" src="play.png" class="run" /></a>
|
||||
<div class="highlight"><pre><span class="kn">package</span> <span class="nx">main</span>
|
||||
</pre></div>
|
||||
|
||||
@ -94,8 +94,7 @@ values received from a channel.</p>
|
||||
<p>This <code>range</code> iterates over each element as it’s
|
||||
received from <code>queue</code>. Because we <code>close</code>d the
|
||||
channel above, the iteration terminates after
|
||||
receiving the 2 elements. If we didn’t <code>close</code> it
|
||||
we’d block on a 3rd receive in the loop.</p>
|
||||
receiving the 2 elements.</p>
|
||||
|
||||
</td>
|
||||
<td class="code">
|
||||
|
Loading…
x
Reference in New Issue
Block a user