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

<lambda>null1 // This file was automatically generated from flow.md by Knit tool. Do not edit.
2 package kotlinx.coroutines.guide.exampleFlow34
3 
4 import kotlinx.coroutines.*
5 import kotlinx.coroutines.flow.*
6 
7 fun simple(): Flow<Int> = (1..3).asFlow()
8 
9 fun main() = runBlocking<Unit> {
10     simple()
11         .onCompletion { cause -> println("Flow completed with $cause") }
12         .collect { value ->
13             check(value <= 1) { "Collected $value" }
14             println(value)
15         }
16 }
17