Skip to content

Commit

Permalink
doc: update doc for Break function
Browse files Browse the repository at this point in the history
  • Loading branch information
duke-git committed Mar 8, 2024
1 parent 5e8a065 commit 73c97af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions docs/api/packages/slice.md
Original file line number Diff line number Diff line change
Expand Up @@ -2603,9 +2603,9 @@ func main() {
}
```

<span id="Break">Break</span>
### <span id="Break">Break</span>

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

<b>示例:</b>

Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions docs/en/api/packages/slice.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand All @@ -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)
Expand Down

0 comments on commit 73c97af

Please sign in to comment.