takeWhile

fun <E> ReceiveChannel<E>.takeWhile(
    context: CoroutineContext = Unconfined,
    predicate: suspend (E) -> Boolean
): ReceiveChannel<E>
(source)

Platform and version requirements: JVM

Returns a channel containing first elements satisfying the given predicate.

The operation is intermediate and stateless. This function consumes all elements of the original ReceiveChannel.