Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
fun add(a: Int, b: Int): Int {
return a + b
fun main() {
runBlocking {
println("Start main")
val sumOf2 = async {
println("Start sumOf2")
add(2, 2)
val sumOf3 = async {
println("Start sumOf3")
add(3, 3)
println("Awaiting the sums")
val total = sumOf2.await() + sumOf3.await()
println("Total is $total")
println("End main")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment