Skip to content

Commit

Permalink
fix iter error
Browse files Browse the repository at this point in the history
  • Loading branch information
kazhuravlev authored Mar 10, 2024
2 parents c188398 + e21c087 commit 7db5e8f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,9 @@ func SliceLastDefault[T any](in []T, defaultVal T) T {
func Slice2Iter[T any](in []T) func(func(int, T) bool) {
return func(yield func(int, T) bool) {
for i := range in {
yield(i, in[i])
if !yield(i, in[i]) {
return
}
}
}
}

0 comments on commit 7db5e8f

Please sign in to comment.