package main import "fmt" func main() { list := []int{1, 2, 3, 45, 13, 16, 7} fmt.Println(ListQuery(list, 13)) } func ListQuery(list []int, k int) int { for i, j := 0, len(list); i < j; i++ { if list[i] == k { return i } } return -1 }