1 /* <lambda>null2 * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. 3 */ 4 5 // This file was automatically generated from flow.md by Knit tool. Do not edit. 6 package kotlinx.coroutines.guide.exampleFlow35 7 8 import kotlinx.coroutines.* 9 import kotlinx.coroutines.flow.* 10 11 // Imitate a flow of events 12 fun events(): Flow<Int> = (1..3).asFlow().onEach { delay(100) } 13 <lambda>null14fun main() = runBlocking<Unit> { 15 events() 16 .onEach { event -> println("Event: $event") } 17 .collect() // <--- Collecting the flow waits 18 println("Done") 19 } 20