how to change multiple variables at once

i want to make a game where the players income is made on the stock market.

im going to start with 30 ish stocks and eventually build it up to over 100.
i want to run a script at a set interval or when the player presses a next day button.
this script will run a calculation on all of the stocks to change the prices.

i was thinking of storing all the stocks in floats as follows:
float stock1 = 123.05f;

float stock 2 = 34.85f;

and so on.

how do i do this so that i can call a script when the player presses a button and have it go through and update all of these in such a way that i can i add to the list.


Try using an array? Something like this:

public float [] stocks;

Then you can specify how many floats are in that array in the inspector, and adjust each one as needed. Each number will have an index (first float has an index of 0, the second has an index of 1, and so on). To change a number in a specific float, address it by index:

stocks[whatever the float is] = new value;

Now, for random numbers, you would want stocks[index] = Random.Range(min value, max value); in a for loop.

For specific numbers, you could set up another array to determine the amount of change that you want, then use a for loop to set each float by index to the index of the new array, or decrease/increase the values by those in the second array.

the array is only going to store a float referenced by the index so then i would need to create a list of the stocks as integers and assign them an index number so that i can access the value related to each stock?
this will work but im wondering it will get messy as the list grows?