Back to Lo

Core Productby

docs/data/core-productby.md

1.53.0217 B
Original Source

Calculates the product of values computed by a predicate. Returns 1 for nil or empty collections.

go
strings := []string{"foo", "bar"}
lo.ProductBy(strings, func(item string) int {
    return len(item)
})
// 9