Junior — Senior
Correction of issues in asynchronous code
livecode
Task condition
It is required to detect and fix the incorrect behavior of the provided Kotlin example.
fun main() = runBlocking {
async { displaySecond() }
async { displayFirst() }
}
fun displayFirst() {
for (idx in 0..10) {
delay(5)
println("displayFirst - $idx")
}
}
fun displaySecond() {
for (idx in 0..10) {
delay(10)
println("displaySecond - $idx")
}
}