Variable name for variable

 

Hey

how reduce this code:

a1  = ...
a2  = ...
a3  = ...
...
a24 = ...


for example:


for(int i=0; i<25; i++)

   {ai = ... ; } // a1, a2, a3 .. a24
 
Esse:

Hey

how reduce this code:

a1  = ...
a2  = ...
a3  = ...
...
a24 = ...


for example:


for(int i=0; i<25; i++)

   {ai = ... ; } // a1, a2, a3 .. a24
With an array.
 
Alain Verleyen:
With an array.

Thank you.


   string strArray[]={"a1", "a2", "a3", "a4", "a5","a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15","a16", "a17", "a18", "a19", "a20", "a21", "a22", "a23","a24"};  
   for(int i=0; i<25; i++)
      {
      strArray[i] = Close[i]; //   <== ai
      Print( strArray[i] );
      }
Reason: