Back to tasksGet help with live coding in real time with Sobes Copilot
Junior — Senior
52
Коррекция проблем в асинхронном коде
Companies where asked:
IBS
Task condition
Требуется обнаружить и устранить некорректное поведение представленного примера на Kotlin.
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")
}
}