Skip to content

Commit 0df2db6

Browse files
committed
Add example for Intersect in Readme
1 parent 51c5c7a commit 0df2db6

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎README.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2570,7 +2570,7 @@ b := NoneBy([]int{1, 2, 3, 4}, func(x int) bool {
25702570

25712571
### Intersect
25722572

2573-
Returns the intersection between two collections.
2573+
Returns the intersection between collections.
25742574

25752575
```go
25762576
result1 := lo.Intersect([]int{0, 1, 2, 3, 4, 5}, []int{0, 2})
@@ -2581,6 +2581,10 @@ result2 := lo.Intersect([]int{0, 1, 2, 3, 4, 5}, []int{0, 6})
25812581

25822582
result3 := lo.Intersect([]int{0, 1, 2, 3, 4, 5}, []int{-1, 6})
25832583
// []int{}
2584+
2585+
2586+
result4 := lo.Intersect([]int{0, 3, 5, 7}, []int{3, 5}, []int{0, 1, 2, 0, 3, 0})
2587+
// []int{3}
25842588
```
25852589

25862590
### Difference

0 commit comments

Comments
 (0)