mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
babddacbf3
* ArrayIn to use generics. * interface{} -> any.
15 lines
213 B
Go
15 lines
213 B
Go
package utils
|
|
|
|
func ArrayIn[T comparable](val T, array []T) (exists bool, index int) {
|
|
exists, index = false, -1
|
|
|
|
for i, a := range array {
|
|
if a == val {
|
|
exists, index = true, i
|
|
return
|
|
}
|
|
}
|
|
|
|
return
|
|
}
|