FindI

FindI[expr, list]

FindI[expr, list] returns the index of the first occurrence of expr in list and -1 if expr does not occur in list. If expr is a list, the list of indices of the first occurrence of each element of expr is returned instead.

Example in out
The first occurrence of c in {a,b,c,d}. FindI[ c, {a,b,c,d} ] 3
The first occurrence of c in {a,b,c,d,c}. FindI[ c, {a,b,c,d,c}] 3
The first occurrence of c in {a,b,a,d}. FindI[ c, {a,b,a,d}] -1
The first occurrence of each of {a,c} in {a,b,c,d}. FindI[{a,c},{a,b,c,d}] {1,3}
The first occurrence of x in l, where x is defined as 7 and l is defined as {2,3,5,7,11} in the script. FindI[x, l] 4