Files
lo/docs/data/core-mode.md
T
Samuel Berthe fa095e4b4f fix(doc): fix go playground demo URL (#832)
* fix(doc): fix go playground demo URL

* fix(doc): add more go playground demo URL
2026-03-06 00:09:59 +01:00

763 B

name, slug, sourceRef, category, subCategory, playUrl, variantHelpers, similarHelpers, position, signatures
name slug sourceRef category subCategory playUrl variantHelpers similarHelpers position signatures
Mode mode math.go#L149 core math https://go.dev/play/p/PbiviqnV5zX
core#math#mode
core#math#mean
core#math#meanby
core#math#sum
core#math#sumby
core#math#product
core#math#productby
core#find#min
core#find#max
core#find#minby
core#find#maxby
core#math#countvalues
core#math#countvaluesby
100
func Mode[T constraints.Integer | constraints.Float](collection []T) []T

Returns the mode(s), i.e., the most frequent value(s) in a collection. If multiple values share the highest frequency, returns all. Empty input yields an empty slice.

lo.Mode([]int{2, 2, 3, 3})
// []int{2, 3}