Files
lo/docs/data/it-countby.md
T
2025-10-08 14:55:05 +02:00

482 B

name, slug, sourceRef, category, subCategory, signatures, playUrl, variantHelpers, similarHelpers, position
name slug sourceRef category subCategory signatures playUrl variantHelpers similarHelpers position
CountBy countby it/seq.go#L325 it find
func CountBy[T any](collection iter.Seq[T], predicate func(item T) bool) int
it#find#count
core#slice#countby
core#slice#count
35

Counts the number of elements in the collection that satisfy the predicate.

result := it.CountBy(it.Range(1, 11), func(item int) bool {
    return item%2 == 0
})
// 5