1 /* 2 * Copyright 2016-2019 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 coroutines-guide-reactive.md by Knit tool. Do not edit. 6 package kotlinx.coroutines.rx2.guide.operators01 7 8 import kotlinx.coroutines.* 9 import kotlinx.coroutines.reactive.* 10 import kotlin.coroutines.CoroutineContext 11 <lambda>null12fun CoroutineScope.range(context: CoroutineContext, start: Int, count: Int) = publish<Int>(context) { 13 for (x in start until start + count) send(x) 14 } 15 <lambda>null16fun main() = runBlocking<Unit> { 17 // Range inherits parent job from runBlocking, but overrides dispatcher with Dispatchers.Default 18 range(Dispatchers.Default, 1, 5).collect { println(it) } 19 } 20