Best way to store a new variable in each iteration of a for loop?

I have a ‘for’ loop that is essential for my project to work. I also need it to save to a new variable and affect other game objects depending on which iteration the loop is on. So far I am managing to get it to work using if statements but it is elongating my code to a size that could be drastically reduced. I just want to know what the best way to store new variables in each iteration of a for loop as it would help me out a lot.

Thanks in advance :slight_smile:

I don’t think I fully understand your question but from what I think it is you could use an array.

float[] floats = new float[numberOfIterations];

for (int i = 0; i < numberOfIterations; i++) {

floats *= 0.0f;*

}