diff --git a/docs/api/packages/slice.md b/docs/api/packages/slice.md index cf1cab44..1e173958 100644 --- a/docs/api/packages/slice.md +++ b/docs/api/packages/slice.md @@ -2603,9 +2603,9 @@ func main() { } ``` -Break +### Break -

TBD

+

根据判断函数将切片分成两部分。它开始附加到与函数匹配的第一个元素之后的第二个切片。第一个匹配之后的所有元素都包含在第二个切片中,无论它们是否与函数匹配。

示例: @@ -2625,7 +2625,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) diff --git a/docs/en/api/packages/slice.md b/docs/en/api/packages/slice.md index 60e3e907..cf11d122 100644 --- a/docs/en/api/packages/slice.md +++ b/docs/en/api/packages/slice.md @@ -2600,7 +2600,7 @@ func main() { } ``` -Break +### Break

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.

@@ -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)