Files
lo/docs/data/it-slice.md
T
2025-10-08 19:35:53 +02:00

23 lines
465 B
Markdown

---
name: Slice
slug: slice
sourceRef: it/seq.go#L680
category: it
subCategory: sequence
signatures:
- "func Slice[T any, I ~func(func(T) bool)](collection I, start, end int) I"
playUrl: "https://go.dev/play/p/5WqJN9-zv"
variantHelpers:
- it#slice#drop
similarHelpers:
- core#slice#slice
- core#slice#chunk
position: 80
---
Returns a sub-sequence from start index to end index (exclusive).
```go
result := it.Slice(it.Range(1, 10), 2, 5)
// [3, 4, 5]
```