1 // This file was automatically generated from composing-suspending-functions.md by Knit tool. Do not edit.
2 package kotlinx.coroutines.guide.exampleCompose03
3 
4 import kotlinx.coroutines.*
5 import kotlin.system.*
6 
<lambda>null7 fun main() = runBlocking<Unit> {
8     val time = measureTimeMillis {
9         val one = async(start = CoroutineStart.LAZY) { doSomethingUsefulOne() }
10         val two = async(start = CoroutineStart.LAZY) { doSomethingUsefulTwo() }
11         // some computation
12         one.start() // start the first one
13         two.start() // start the second one
14         println("The answer is ${one.await() + two.await()}")
15     }
16     println("Completed in $time ms")
17 }
18 
doSomethingUsefulOnenull19 suspend fun doSomethingUsefulOne(): Int {
20     delay(1000L) // pretend we are doing something useful here
21     return 13
22 }
23 
doSomethingUsefulTwonull24 suspend fun doSomethingUsefulTwo(): Int {
25     delay(1000L) // pretend we are doing something useful here, too
26     return 29
27 }
28