I need to perform a number of operations within a
For loop and store the results in an indexed array (without using the Append function)
For examole (to make it simple), I need to find the square of numbers i = 1 to 5 and sore it in y[i].
In precedural languages it would look like:
for i = 1,5,i++, y(i)=i^2 end
To implement this in Mathematica I tried this code:
For[i = 1, i <= 5, i++, y[[i]] = i^2; ]
which failed. Is there a way to create such array (y)?