Choosing between variables based on number

I have 6 variables, and I want to choose one of them based on the value of an int that I have (eg choose variable 2 if the int is 2). Is there a function that does this already?

Yes select on int and switch on int.

But if all variables are of same type for eg all of them are integer,

you are talking about array of same type elements.

For such choosing logic i would recommend creating ENUM with descriptive names, then select on enum, Such code documents self.

I ended up doing a simple selection, thank you for your help.