From 9cd6b0fca87679e570fbdd4942e3068feb3439fa Mon Sep 17 00:00:00 2001 From: Alexander Kiryukhin Date: Thu, 7 Apr 2022 21:36:40 +0300 Subject: initial --- example_each_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 example_each_test.go (limited to 'example_each_test.go') diff --git a/example_each_test.go b/example_each_test.go new file mode 100644 index 0000000..211494a --- /dev/null +++ b/example_each_test.go @@ -0,0 +1,17 @@ +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) + }) +} -- cgit v1.2.3