Files
lo/docs/data/core-foreach.md
T
2025-10-06 17:15:49 +02:00

593 B

name, slug, sourceRef, category, subCategory, playUrl, variantHelpers, similarHelpers, position, signatures
name slug sourceRef category subCategory playUrl variantHelpers similarHelpers position signatures
ForEach foreach slice.go#L107 core slice https://go.dev/play/p/oofyiUPRf8t
core#slice#foreach
core#slice#times
core#slice#map
core#slice#foreachwhile
parallel#slice#foreach
70
func ForEach[T any](collection []T, iteratee func(item T, index int))

Iterates over elements of a collection and invokes the callback for each element.

lo.ForEach([]string{"hello", "world"}, func(x string, _ int) {
    println(x)
})
// prints "hello\nworld\n"