https://kotlinlang.org logo
#coroutines
Title
# coroutines
a

Adam Powell

11/01/2019, 2:06 PM
Is the example posted at https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-dispatchers/-unconfined.html correct? How can it print
1 3 2
given that
withContext
returns the
T
from the block, which would be the
Unit
from executing
println(2)
first?
p

Patrick Hum

11/01/2019, 9:51 PM
I’m no expert, but from what I know, you’re right,
withContext
is a suspend call. Perhaps they’re missing a
launch
to prove their point?