So, for
loop is like foreach
in more strong type languages, in your case you take a number and iterate through it(which doesnt work fyi), if you want to iterate all the way up to the size of the array like for(int i = 0; i < Array.size(); i++)
you will need to do for i in range(Array.size())
.
if you want to iterate with an iteration variable a fixed number of times you need to use the range
keyword.
the range
keyword can be used with up to 3 parameters:
range(x)
- from 0 to x ( excluding x )
range(y,x)
- from y to x ( including y, excluding x )
range(y,x,z)
- from y to x, raising the iteration by z
(for example range(1,10,2)
will result in [1, 3, 5, 7, 9]
Hope it helps you or any other gal stumbling across this, and have a nice day