Skip to content

Commit c170373

Browse files
tatsuyafujisakibradynpoulsen
authored andcommitted
Replace "for" with "repeat"
1 parent e153863 commit c170373

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

README.md

-1
Original file line numberDiff line numberDiff 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

docs/channels.md

+4-2
Original file line numberDiff line numberDiff 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.*
297299
fun 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)

kotlinx-coroutines-core/jvm/test/guide/example-channel-04.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import kotlinx.coroutines.channels.*
1111
fun 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
}

kotlinx-coroutines-core/jvm/test/guide/example-channel-05.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import kotlinx.coroutines.channels.*
1010

1111
fun 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)

0 commit comments

Comments
 (0)