From b838b865bb493cb1dafc87f887fd4a68b48d21f1 Mon Sep 17 00:00:00 2001 From: Samuel Berthe Date: Sat, 10 Aug 2024 01:22:03 +0200 Subject: [PATCH] Update slice.go --- slice.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/slice.go b/slice.go index 431aaf04..d2d3fd84 100644 --- a/slice.go +++ b/slice.go @@ -95,7 +95,8 @@ func ForEach[T any](collection []T, iteratee func(item T, index int)) { } // ForEachWhile iterates over elements of collection and invokes iteratee for each element -// collection return value decide to continue or break ,just like do while() +// collection return value decide to continue or break, like do while(). +// Play: https://go.dev/play/p/QnLGt35tnow func ForEachWhile[T any](collection []T, iteratee func(item T, index int) (goon bool)) { for i := range collection { if !iteratee(collection[i], i) {