is it possible to put a "for loop with break" into a function ?

Guys, I may have misunderstood, but the “contains” function on the array would do the job just fine wouldn’t it ? It seems you can’t access the index of the result element though, but I don’t know if that’s important in your script.