Question du test Kotlin

Écrire un programme Kotlin qui imprime la sortie suivante : 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  ")
}

Quelle est la sortie du programme ci-dessus ?

Auteur: Équipe W3DStatut : PubliéeQuestion passée 457 fois
Modifier
0
Évaluations de la communautéPersonne n'a encore évalué cette question, soyez le premier !