I want to create a coroutine method which has returning value.
For example)
fun funA() = async(CommonPool) { return 1 } fun funB() = async(Commo
Adding another way of achieving it.
fun sum(): Int { var sum: Int = 0 runBlocking { val jobA = async { funA() } val jobB = async { funB() } runBlocking{ sum = jobA.await() + jobB.await() } } return sum } suspend fun funA(): Int { return 1 } suspend fun funB(): Int { return 2 }