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

<lambda>null1 // This file was automatically generated from flow.md by Knit tool. Do not edit.
2 package kotlinx.coroutines.guide.exampleFlow39
3 
4 import kotlinx.coroutines.*
5 import kotlinx.coroutines.flow.*
6 
7 fun main() = runBlocking<Unit> {
8     (1..5).asFlow().cancellable().collect { value ->
9         if (value == 3) cancel()
10         println(value)
11     }
12 }
13