3
Ich bin neu lernen, Coroutine und Kotlin. Warum erhalte ich unterschiedliche Ergebnisse, unten Fall 1 und 2?kotlin coroutine val vs Spaß
fun main(args: Array<String>) = runBlocking {
fun a() = async(CommonPool) {
println("start A")
delay(1000)
println("finish A")
}
fun b() = async(CommonPool) {
println("start B")
delay(1000)
println("finish B")
}
//case 1
a().await()
b().await()
//case 2
val A = a()
val B = b()
A.await()
B.await()
}
Ist diese Val-Style-Codierung grundlegend?
Ah, OK! jetzt verstehe ich. Danke für Ihre Antwort! –