async1 (Coroutine) 3. async 1. suspend 함수의 순차적 수행 아래 예시를 통해 suspend 함수를 순차적으로 수행해보자. suspend fun getRandom1(): Int { delay(1000L) return Random.nextInt(0, 500) } suspend fun getRandom2(): Int { delay(1000L) return Random.nextInt(0, 500) } fun main() = runBlocking { val elapsedTime = measureTimeMillis { val value1 = getRandom1() val value2 = getRandom2() println("$value1 + $value2 = ${value1+value2}") } println(elapsedTime).. 2022. 9. 14. 이전 1 다음