Skip to content

Commit 58c61c7

Browse files
bdavisxelizarov
authored andcommitted
Updated the guide fan-out section to use channel iterator
1 parent c0db4d3 commit 58c61c7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

core/kotlinx-coroutines-core/src/test/kotlin/guide/example-channel-06.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ fun produceNumbers() = produce<Int> {
2929
}
3030

3131
fun launchProcessor(id: Int, channel: ReceiveChannel<Int>) = launch {
32-
channel.consumeEach {
33-
println("Processor #$id received $it")
32+
for (msg in channel) {
33+
println("Processor #$id received $msg")
3434
}
3535
}
3636

coroutines-guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,8 +1531,8 @@ received number:
15311531

15321532
```kotlin
15331533
fun launchProcessor(id: Int, channel: ReceiveChannel<Int>) = launch {
1534-
channel.consumeEach {
1535-
println("Processor #$id received $it")
1534+
for (msg in channel) {
1535+
println("Processor #$id received $msg")
15361536
}
15371537
}
15381538
```

0 commit comments

Comments
 (0)