doc: update doc for Break function

This commit is contained in:
dudaodong committed 2024-03-08 21:39:06 +08:00
1 parent 5e8a065eaa
commit 73c97af7d8
2 files changed
+5 -5

No files matched your search

+2 -2
View File
@@ -2600,7 +2600,7 @@ func main() {
}
```
<span id="Break">Break</span>
### <span id="Break">Break</span>
<p>Splits a slice into two based on a predicate function. It starts appending to the second slice after the first element that matches the predicate. All elements after the first match are included in the second slice, regardless of whether they match the predicate or not.</p>
@@ -2622,7 +2622,7 @@ func main() {
nums := []int{1, 2, 3, 4, 5}
even := func(n int) bool { return n%2 == 0 }
resultEven, resultAfterFirstEven := Break(nums, even)
resultEven, resultAfterFirstEven := slice.Break(nums, even)
fmt.Println(resultEven)
fmt.Println(resultAfterFirstEven)