diff options
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | docs/channels.md | 6 | ||||
-rw-r--r-- | kotlinx-coroutines-core/jvm/test/guide/example-channel-04.kt | 4 | ||||
-rw-r--r-- | kotlinx-coroutines-core/jvm/test/guide/example-channel-05.kt | 2 |
4 files changed, 8 insertions, 5 deletions
@@ -273,7 +273,6 @@ The `develop` branch is pushed to `master` during release. [ListenableFuture.await]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-guava/kotlinx.coroutines.guava/com.google.common.util.concurrent.-listenable-future/await.html <!--- MODULE kotlinx-coroutines-play-services --> <!--- INDEX kotlinx.coroutines.tasks --> -[Task.await]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-play-services/kotlinx.coroutines.tasks/com.google.android.gms.tasks.-task/await.html <!--- MODULE kotlinx-coroutines-reactive --> <!--- INDEX kotlinx.coroutines.reactive --> [Publisher.collect]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-reactive/kotlinx.coroutines.reactive/org.reactivestreams.-publisher/collect.html diff --git a/docs/channels.md b/docs/channels.md index 55507597..6f5f0697 100644 --- a/docs/channels.md +++ b/docs/channels.md @@ -209,7 +209,9 @@ fun main() = runBlocking { //sampleStart val numbers = produceNumbers() // produces integers from 1 and on val squares = square(numbers) // squares integers - for (i in 1..5) println(squares.receive()) // print first five + repeat(5) { + println(squares.receive()) // print first five + } println("Done!") // we are done coroutineContext.cancelChildren() // cancel children coroutines //sampleEnd @@ -297,7 +299,7 @@ import kotlinx.coroutines.channels.* fun main() = runBlocking { //sampleStart var cur = numbersFrom(2) - for (i in 1..10) { + repeat(10) { val prime = cur.receive() println(prime) cur = filter(cur, prime) diff --git a/kotlinx-coroutines-core/jvm/test/guide/example-channel-04.kt b/kotlinx-coroutines-core/jvm/test/guide/example-channel-04.kt index 4eb6c37d..81fdd37e 100644 --- a/kotlinx-coroutines-core/jvm/test/guide/example-channel-04.kt +++ b/kotlinx-coroutines-core/jvm/test/guide/example-channel-04.kt @@ -11,7 +11,9 @@ import kotlinx.coroutines.channels.* fun main() = runBlocking { val numbers = produceNumbers() // produces integers from 1 and on val squares = square(numbers) // squares integers - for (i in 1..5) println(squares.receive()) // print first five + repeat(5) { + println(squares.receive()) // print first five + } println("Done!") // we are done coroutineContext.cancelChildren() // cancel children coroutines } diff --git a/kotlinx-coroutines-core/jvm/test/guide/example-channel-05.kt b/kotlinx-coroutines-core/jvm/test/guide/example-channel-05.kt index 8b80764a..d6ad2e51 100644 --- a/kotlinx-coroutines-core/jvm/test/guide/example-channel-05.kt +++ b/kotlinx-coroutines-core/jvm/test/guide/example-channel-05.kt @@ -10,7 +10,7 @@ import kotlinx.coroutines.channels.* fun main() = runBlocking { var cur = numbersFrom(2) - for (i in 1..10) { + repeat(10) { val prime = cur.receive() println(prime) cur = filter(cur, prime) |