Hm, the thing is, you're not really using Arrays here. You just put some instance variable on the array and use these.
Every object can have instance variables. It's not really what arrays are for (:
Also, I think that your expression could be simplified this way:
newPrice = round(formerPrice * random(0.85,1.20))
Thanks, that is a much simpler expression. (I am assuming that random(0.8,1.2)will give me any range between those 2 numbers?)
And about arrays and variables, yes I am starting to see that now and not sure what is the best for what I want to do.
Dictionary sounds like a nice way to store info, and instance variables have been what I have been using, but what is best for storing a table of numbers?
I still don't really know how to use the array in a way that is easy for me to keep straight in my mind.
For example I want to store a table of base prices for things which vary by market. (for example 10 items and 6 markets.) And I would like to be able to easily get the value from for instance Item3 Market5.
In my mind i can visualize 2 and 3 dimensional arrays, but I think of them with labels for each row, column and depth. Is it possible to work with arrays that way, or can they only be used by number references?
Also what is the advantages and disadvantages to using Dictionary vs instance variables for storing variables?
Thanks for he help,