Hi everyone, I have some confusion with two result...
# coroutines
t
Hi everyone, I have some confusion with two results, the first is Kotlin JVM and the second is Android Application. Anyone can help me to explain why it a difference in results with the same code logic?
a
In JVM program stops after
main
done. You should add something after
launch
❤️ 1
t
Thank you for your response, your mean is this, right?
a
No. Something like
Copy code
runBlocking {
    delay(3000)
}
❤️ 1
t
Thank you for you help, your way can lead to race condition.
a
p
Do
suspend fun main()
instead of
GlobalScope.launch
❤️ 1
otherwise,
runBlocking { GlobalScope.launch { } }
is what you're after
❤️ 1
both are equivalent
❤️ 1
t
Thank for your help let me try!