Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumKotlincoroutines basics launch asyncSingle-choice MCQ

Two values are computed with async. What does this print and why?

import kotlinx.coroutines.* import kotlin.system.measureTimeMillis fun main() = runBlocking { val time = measureTimeMillis { val a = async { delay(1000); 1 } val b = async { delay(1000); 2 } println(a.await() + b.await()) } println("took ${time}ms (approx)") }