Back to tasks
amoCRMGet help with live coding in real time with Sobes Copilot
Junior — Senior
55
Как происходит выполнение и синхронизация async‑корутин
Companies where asked:
Task condition
Определите, какой текст появится в консоль после запуска следующего фрагмента кода.
val coroutineContext = Job() + Dispatchers.IO
val mainScope = CoroutineScope(coroutineContext)
mainScope.launch {
val deferred1 = async {
delay(1000)
"1"
}
val deferred2 = async {
delay(500)
"2"
}
deferred1.join()
println(deferred2.await())
}