Sobes.tech
Junior — Senior

Order of coroutine execution inside coroutineScope

livecode

Task condition

What will be the output after running the following code:

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)
}