blob: 2fc7abcae3113761dfb8f65d863fc747492a4ca5 [file] [log] [blame]
Roman Elizarov8a4a8e12017-03-09 19:52:58 +03001/*
Roman Elizarov1f74a2d2018-06-29 19:19:45 +03002 * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
Roman Elizarov8a4a8e12017-03-09 19:52:58 +03003 */
4
5// This file was automatically generated from coroutines-guide-reactive.md by Knit tool. Do not edit.
Roman Elizarova9687a32018-06-29 17:28:38 +03006package kotlinx.coroutines.experimental.rx2.guide.basic04
Roman Elizarov8a4a8e12017-03-09 19:52:58 +03007
Roman Elizarov95981f32017-03-17 18:12:04 +03008import io.reactivex.*
9import kotlinx.coroutines.experimental.*
10import kotlinx.coroutines.experimental.reactive.*
Roman Elizarov9fe5f462018-02-21 19:05:52 +030011import kotlin.coroutines.experimental.*
Roman Elizarov8a4a8e12017-03-09 19:52:58 +030012
13fun main(args: Array<String>) = runBlocking<Unit> {
14 val source = Flowable.range(1, 5) // a range of five numbers
15 .doOnSubscribe { println("OnSubscribe") } // provide some insight
Roman Elizarov0dffcfd2018-06-29 18:51:52 +030016 .doOnComplete { println("OnComplete") } // ...
Roman Elizarov8a4a8e12017-03-09 19:52:58 +030017 .doFinally { println("Finally") } // ... into what's going on
Roman Elizarov86349be2017-03-17 16:47:37 +030018 // iterate over the source fully
19 source.consumeEach { println(it) }
Roman Elizarov8a4a8e12017-03-09 19:52:58 +030020}