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.exampleFlow27 7 8 import kotlinx.coroutines.* 9 import kotlinx.coroutines.flow.* 10 11 fun simple(): Flow<String> = 12 flow { 13 for (i in 1..3) { 14 println("Emitting $i") 15 emit(i) // emit next value 16 } 17 } valuenull18 .map { value -> 19 check(value <= 1) { "Crashed on $value" } 20 "string $value" 21 } 22 <lambda>null23fun main() = runBlocking<Unit> { 24 try { 25 simple().collect { value -> println(value) } 26 } catch (e: Throwable) { 27 println("Caught $e") 28 } 29 } 30