Quickly find array position of an item

Hi,
I have a piston that will be run from webhook with argument. To make a short story, I have multiple program name that match with 2 id each, id that I want to use inside webrequest. So, the argument program should dict wich id to use.

I could use a lot of condition and compare to make it works, but it could be very short and sweet if I could make it works this way:

I made a variable that contains all program name and id like:

myvar= [program1,id1,program2,id2,program3,id3]

So I would like to find the index of the $arg.program

because if its a positive value it means that its within the array and then I could use the index+1 to use in my url. If no match nothing happen and if a match is found it must proceed the right api call.

So I would like to know if it exist a way to get the index position or something? Loop looks overkill. Also, I use a dynamic variable, not a list one because its messy to use, but its populate the same so I can use

arrayItem() to get my value...

Thanks!

few thoughts

you can use two lists input match and output match

if the lists are not long, looping is just fine.

should look at indexOf as a possible function to help

https://wiki.webcore.co/Functions

thanks for reply!
For now I use for loop because my value to compare is an $args from the url to trig the piston... Its working well ... index of not working because it return the string index, not the array index.