1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00

doc: add go playground demo

This commit is contained in:
dudaodong
2023-03-22 21:06:01 +08:00
parent 0aa41f337d
commit f09e521783
4 changed files with 12 additions and 3 deletions

View File

@@ -423,6 +423,7 @@ func ForEach[T any](slice []T, iteratee func(index int, item T)) {
// ForEachWithBreak iterates over elements of slice and invokes function for each element,
// when iteratee return false, will break the for each loop.
// Play: https://go.dev/play/p/qScs39f3D9W
func ForEachWithBreak[T any](slice []T, iteratee func(index int, item T) bool) {
for i, v := range slice {
if !iteratee(i, v) {