File tree Expand file tree Collapse file tree 4 files changed +8
-5
lines changed
kotlinx-coroutines-core/jvm/test/guide Expand file tree Collapse file tree 4 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -273,7 +273,6 @@ The `develop` branch is pushed to `master` during release.
273273[ ListenableFuture.await ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-guava/kotlinx.coroutines.guava/com.google.common.util.concurrent.-listenable-future/await.html
274274<!-- - MODULE kotlinx-coroutines-play-services -->
275275<!-- - INDEX kotlinx.coroutines.tasks -->
276- [ Task.await ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-play-services/kotlinx.coroutines.tasks/com.google.android.gms.tasks.-task/await.html
277276<!-- - MODULE kotlinx-coroutines-reactive -->
278277<!-- - INDEX kotlinx.coroutines.reactive -->
279278[ Publisher.collect ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-reactive/kotlinx.coroutines.reactive/org.reactivestreams.-publisher/collect.html
Original file line number Diff line number Diff line change @@ -209,7 +209,9 @@ fun main() = runBlocking {
209209// sampleStart
210210 val numbers = produceNumbers() // produces integers from 1 and on
211211 val squares = square(numbers) // squares integers
212- for (i in 1 .. 5 ) println (squares.receive()) // print first five
212+ repeat(5 ) {
213+ println (squares.receive()) // print first five
214+ }
213215 println (" Done!" ) // we are done
214216 coroutineContext.cancelChildren() // cancel children coroutines
215217// sampleEnd
@@ -297,7 +299,7 @@ import kotlinx.coroutines.channels.*
297299fun main () = runBlocking {
298300// sampleStart
299301 var cur = numbersFrom(2 )
300- for (i in 1 .. 10 ) {
302+ repeat( 10 ) {
301303 val prime = cur.receive()
302304 println (prime)
303305 cur = filter(cur, prime)
Original file line number Diff line number Diff line change @@ -11,7 +11,9 @@ import kotlinx.coroutines.channels.*
1111fun main () = runBlocking {
1212 val numbers = produceNumbers() // produces integers from 1 and on
1313 val squares = square(numbers) // squares integers
14- for (i in 1 .. 5 ) println (squares.receive()) // print first five
14+ repeat(5 ) {
15+ println (squares.receive()) // print first five
16+ }
1517 println (" Done!" ) // we are done
1618 coroutineContext.cancelChildren() // cancel children coroutines
1719}
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import kotlinx.coroutines.channels.*
1010
1111fun main () = runBlocking {
1212 var cur = numbersFrom(2 )
13- for (i in 1 .. 10 ) {
13+ repeat( 10 ) {
1414 val prime = cur.receive()
1515 println (prime)
1616 cur = filter(cur, prime)
You can’t perform that action at this time.
0 commit comments