Back to Lo

It Drain

docs/data/it-drain.md

1.53.0234 B
Original Source

Drain consumes an entire sequence.

go
collection := func(yield func(int) bool) {
    yield(1)
    yield(2)
    yield(3)
    fmt.Println("yielding")
}

it.Drain(collection)
// prints "yielding" three times, sequence is consumed