English

## a noobie question - help please

 736 honest_knave 2016.02.01 10:57 #   If I understand what you want correctly, you want a user input which chooses which variable gets used in later calculations?If so, you can't do that directly. You'd need to use a switch or if statement. ```enum variables   {    value1, // Use MyVal1    value2, // Use MyVal2    value3  // Use MyVal3   }; extern variables number = value1; void OnTick()   {    double MyVal1=10,           MyVal2=20,           MyVal3=30;    switch(number)      {       case value1: Print(MyVal1); break;       case value2: Print(MyVal2); break;       case value3: Print(MyVal3); break;      }   } ```
 736 honest_knave 2016.02.01 11:05 #   Yep, that is what my example above should help you with.I used an enumeration because it is cleaner for the end user and a switch statement is better for a large number of options, but you'd get exactly the same result using int and 'if' statements:```extern int number = 1; void OnTick()   {    double MyVal1=10,           MyVal2=20,           MyVal3=30,           value =27;    if(number==1)      { if(MyVal1==value) {} }    else if(number==2) { if(MyVal2==value) {} }    else if(number==3) { if(MyVal3==value) {} }   }```
 736 honest_knave 2016.02.01 11:12 #   Alternatively, you can use the array like GumRai mentioned:```extern int number = 1; void OnTick()   {    double MyVal0=10,           MyVal1=20,           MyVal2=30;    double Values[3];    Values[0]=MyVal0;    Values[1]=MyVal1;    Values[2]=MyVal2;    if(Values[number]==27)       {```