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