I am sure that there is a very simple answer and I am perhaps just being forgetful, but I cannot remember how to use a variable to define the name of another variable. I cannot even think of a name of this process to search for existing answers.
I have a variable: VarA, which will be an integer 1, 2, 3, 4, etc.
I have another set of arrays VarBn[] where 'n' is related to VarA.
So, when VarA=1 I want to know VarB1[], and when VarA=2 ... VarB2[]
I currently have a very long and replicated switch statement...
switch(VarA)
case 1: x=VarB1[]; break;
case 2: x=VarB2[]; break;
case 3: x=VarB3[]; break;
case 4: x=VarB4[]; break;
But it would be far smaller function if it were just one line...
x=VarB+"contents of VarA"+[];