mirror of
https://github.com/onyx-and-iris/vbantxt-cli.git
synced 2024-09-27 09:16:59 +01:00
12 lines
201 B
Go
12 lines
201 B
Go
package main
|
|
|
|
// indexOf returns the index of an element in an array
|
|
func indexOf[T comparable](collection []T, e T) int {
|
|
for i, x := range collection {
|
|
if x == e {
|
|
return i
|
|
}
|
|
}
|
|
return -1
|
|
}
|