diff --git a/iter/iter_test.go b/iter/iter_test.go index eb06ad9..6309d98 100644 --- a/iter/iter_test.go +++ b/iter/iter_test.go @@ -17,13 +17,14 @@ func ExampleIterator() { } iterator.ForEach(input, func(v *int) { - if *v%2 == 0 { - fmt.Println(*v) + if *v%2 != 0 { + *v = -1 } }) + + fmt.Println(input) // Output: - // 2 - // 4 + // [-1 2 -1 4] } func TestIterator(t *testing.T) {