Sobes.tech
Back to tasks
Junior — Senior
61

Порядок выполнения корутин внутри coroutineScope

Companies where asked:

amoCRMamoCRM
Get help with live coding in real time with Sobes Copilot
Task condition

Какой результат будет напечатан после запуска следующего кода:

val coroutineContext = Job() + Dispatchers.Default

val mainScope = CoroutineScope(coroutineContext)

mainScope.launch {
    launch {
        println(1)
    }

    coroutineScope<Unit> {
        launch {
            delay(500)
            println(2)
        }
        delay(100)
        println(3)
        
    }

    println(4)
}