1 /* 2 * 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 composing-suspending-functions.md by Knit tool. Do not edit. 6 package kotlinx.coroutines.guide.exampleCompose02 7 8 import kotlinx.coroutines.* 9 import kotlin.system.* 10 <lambda>null11fun main() = runBlocking<Unit> { 12 val time = measureTimeMillis { 13 val one = async { doSomethingUsefulOne() } 14 val two = async { doSomethingUsefulTwo() } 15 println("The answer is ${one.await() + two.await()}") 16 } 17 println("Completed in $time ms") 18 } 19 doSomethingUsefulOnenull20suspend fun doSomethingUsefulOne(): Int { 21 delay(1000L) // pretend we are doing something useful here 22 return 13 23 } 24 doSomethingUsefulTwonull25suspend fun doSomethingUsefulTwo(): Int { 26 delay(1000L) // pretend we are doing something useful here, too 27 return 29 28 } 29