This message was deleted.
# coroutines
s
This message was deleted.
t
Because main is ended before it can start.
launch { start a coroutine and immediately returns, so for the last call, you start the coroutine, exit the foreach block and main is ended
add a delay after the last } and see if it works ­čśë
m
The default capacity of the actor-channel is 0 (Rendevouz), so main will suspend on
send
until the actor reads the message. When the actor reads the final message, main will immediately finish before the actor can has time to actually process it.
That's why you only miss the last one.
b
the "structured" way to fix this is to change it to
CoroutineScope.testActor = actor<Int> {
Ô׼ 1
and then close the actor