Back to Lo

Core Take

docs/data/core-take.md

1.53.0151 B
Original Source

Takes the first n elements from a slice.

go
lo.Take([]int{0, 1, 2, 3, 4, 5}, 3)
// []int{0, 1, 2}

lo.Take([]int{0, 1, 2}, 5)
// []int{0, 1, 2}