Skip to content

Commit

Permalink
Replace "for" with "repeat"
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsuyafujisaki authored and qwwdfsad committed Jan 15, 2020
1 parent fa8de2e commit 9be85a4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion README.md
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions docs/channels.md
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion kotlinx-coroutines-core/jvm/test/guide/example-channel-04.kt
Expand Up @@ -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
}
Expand Down
Expand Up @@ -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)
Expand Down

0 comments on commit 9be85a4

Please sign in to comment.