slices.Values - срез как итератор для range

Изменения в новых версиях / Go 1.23

nums := []int{1, 2, 3}

// *** before: ***
for i := 0; i < len(nums); i++ {
    fmt.Println(nums[i])
}

// *** in version 1.23: ***
// handy where the iterator is needed as a value - to pass it,
// say, to a function that expects iter.Seq[int]
for n := range slices.Values(nums) {
    fmt.Println(n)
}