Skip to content

Commit 3feef05

Browse files
joffrey-bionelizarov
authored andcommitted
Remove unnecessary function declaration from example
The produceSquares() function is probably a leftover, because only produceNumbers() and square() are actually used in the code sample.
1 parent b8a559d commit 3feef05

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

docs/channels.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,11 @@ fun main() = runBlocking {
219219
//sampleEnd
220220
}
221221

222-
fun CoroutineScope.produceSquares(): ReceiveChannel<Int> = produce {
223-
for (x in 1..5) send(x * x)
224-
}
225-
226222
fun CoroutineScope.produceNumbers() = produce<Int> {
227223
var x = 1
228224
while (true) send(x++) // infinite stream of integers starting from 1
229225
}
226+
230227
fun CoroutineScope.square(numbers: ReceiveChannel<Int>): ReceiveChannel<Int> = produce {
231228
for (x in numbers) send(x * x)
232229
}

0 commit comments

Comments
 (0)