Todo: add todo for playground demo of function

This commit is contained in:
dudaodong
2023-01-07 18:27:07 +08:00
parent 2f184907ff
commit 278733d3d1
6 changed files with 14 additions and 11 deletions

View File

@@ -10,6 +10,7 @@ import "github.com/duke-git/lancet/v2/lancetconstraints"
// LinearSearch return the index of target in slice base on equal function.
// If not found return -1
// Play: Todo
func LinearSearch[T any](slice []T, target T, equal func(a, b T) bool) int {
for i, v := range slice {
if equal(v, target) {