Standard library / slices
slices.Values()
Yields elements in ascending index order, without yielding indices. Honors early termination. Expected stdout: '3\n4\n'.
Formal Syntax & Structure
go syntaxgo
func Values[Slice ~[]E, E any](s Slice) iter.Seq[E]Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| s | Slice | Input slice; may share its backing array. |
Return Value
iter.Seq[E]
Yields elements in ascending index order, without yielding indices. Honors early termination.
Working Example
Example Snippetgo
package main
import ( "fmt" "slices")
func main() { for v := range slices.Values([]int{3, 4}) { fmt.Println(v) }}