How to clear sent values from Coroutine's Channel?

2.5k Views Asked by At

Lets say I've sent a few values in a channel,

val channel = Channel<Int>()
launch {
    for (x in 1..5) channel.send(x * x)
}

How can I "clear" them? Meaning consume them without using them

0

There are 0 best solutions below