Question from the Kotlin test

Write a Kotlin program that prints the following output: GA - Task from coroutine scope BU - Task from runBlocking ZO - Task from nested launch MEU - Coroutine scope is over

Expert
import kotlinx.coroutines.*

fun main() = runBlocking { // this: CoroutineScope
    launch {
        delay(200L)
        println("BU - Task from runBlocking")
    }

    coroutineScope { // Creates a coroutine scope
        launch {
            delay(500L)
            println("ZO - Task from nested launch ")
        }

        delay(100L)
        println("GA - Task from coroutine scope  ")
    }

    println("MEU - Coroutine scope is over  ")
}

What is the output of the above program?

Author: W3D TeamStatus: PublishedQuestion passed 475 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!