collection/example_each_test.go

18 lines
339 B
Go
Raw Permalink Normal View History

2022-04-07 21:36:40 +03:00
package collection
import "fmt"
func ExampleEach() {
collection := []int{1, 2, 3, 4, 5, 6}
Each(collection, func(v int, idx int) {
fmt.Printf("Element %d: %d\n", idx, v)
})
}
func ExampleEachSync() {
collection := []int{1, 2, 3, 4, 5, 6}
EachSync(collection, func(v int, idx int) {
fmt.Printf("Element %d: %d\n", idx, v)
})
}