Files
lo/docs/data/it-dropwhile.md
T
2025-10-06 17:16:33 +02:00

705 B

name, slug, sourceRef, category, subCategory, signatures, variantHelpers, similarHelpers, position
name slug sourceRef category subCategory signatures variantHelpers similarHelpers position
DropWhile dropwhile it/seq.go#L180 it sequence
func DropWhile[T any, I ~func(func(T) bool)](collection I, predicate func(item T) bool) I
core#slice#dropwhile
it#sequence#drop
162

DropWhile drops elements from the beginning of a sequence while the predicate returns true.

collection := func(yield func(int) bool) {
    yield(1)
    yield(2)
    yield(3)
    yield(4)
    yield(5)
}

filtered := it.DropWhile(collection, func(x int) bool {
    return x < 3
})
var result []int
for item := range filtered {
    result = append(result, item)
}
// result contains [3, 4, 5]