xref: /aosp_15_r20/external/kotlinx.coroutines/kotlinx-coroutines-core/jvm/test/guide/example-basic-04.kt (revision 7a7160fed73afa6648ef8aa100d4a336fe921d9a)
1 // This file was automatically generated from coroutines-basics.md by Knit tool. Do not edit.
2 package kotlinx.coroutines.guide.exampleBasic04
3 
4 import kotlinx.coroutines.*
5 
6 // Sequentially executes doWorld followed by "Done"
<lambda>null7 fun main() = runBlocking {
8     doWorld()
9     println("Done")
10 }
11 
12 // Concurrently executes both sections
doWorldnull13 suspend fun doWorld() = coroutineScope { // this: CoroutineScope
14     launch {
15         delay(2000L)
16         println("World 2")
17     }
18     launch {
19         delay(1000L)
20         println("World 1")
21     }
22     println("Hello")
23 }
24