xref: /aosp_15_r20/external/kotlinx.coroutines/kotlinx-coroutines-core/jvm/test/guide/example-flow-02.kt (revision 7a7160fed73afa6648ef8aa100d4a336fe921d9a)

<lambda>null1 // This file was automatically generated from flow.md by Knit tool. Do not edit.
2 package kotlinx.coroutines.guide.exampleFlow02
3 
4 fun simple(): Sequence<Int> = sequence { // sequence builder
5     for (i in 1..3) {
6         Thread.sleep(100) // pretend we are computing it
7         yield(i) // yield next value
8     }
9 }
10 
mainnull11 fun main() {
12     simple().forEach { value -> println(value) }
13 }
14