package main

import (
	"fmt"
	"slices"
)

func main() {
	// section: example
	fruits := []string{"apple", "banana", "cherry"}

	// slices.All returns an iterator over index-value pairs
	// This is similar to range, but returns an iterator
	fmt.Println("Using slices.All:")
	for i, v := range slices.All(fruits) {
		fmt.Printf("  index %d: %s\n", i, v)
	}

	// Useful when you need to pass an iterator to another function
	// or when working with iterator-based APIs
	// section: example
}
