Try skipping directly to my example; I think being shown makes more sense than being told. I am not liable if I suck at explaining things. :P
For loops generally repeat a segment of code multiple times, increasing a variable each time. Basically it's six parts. For example:
1 2 3 4 5 6
for i in 0...array.size
for - You obviously need this to tell the program that it's a for loop.
i - This is the variable that is being increased.
in - Just put it. It's necessary.
0 - The number that
i (the variable being increased) should start at.
... - '...' means go up to but not including the number following. '..' means go up to and include the number following.
array.size - This is just an example, but this should be a number that is the maximum (i.e. where the variable should stop being increased).
--- EXAMPLE ---
Say you have some fruits in a bag. In RGSS you'd represent that as an array. Something like:
fruits[0] fruits[1] fruits[2] fruits[3]
fruits = ["Apple", "Orange", "Cantaloupe", "Banana"]
But now we want to make them all plural (i.e. "Apples", "Oranges", etc.) To do that to one item, we would do something like:
But if we just repeat that segment of code, it will just keep adding "s" to the first item in the list, so we'd end up with "Applessss" and the rest would still be singular.
So we need a for loop. We need to tell it to do it for item 0, 1, 2, and 3. But instead of writing each line individually, we can do this:
for i in 0...fruits.size
fruits[i] += "s"
end
That tells it to do it for fruits
where i is any number from 0 up to (but not including) the size of the array (which is 4, since there are 4 fruits).
This is much more helpful if you either have a lot of items (we don't want to write 100 lines of code to add an "s" to our fruits! Cookie to anyone that can actually name 100 fruits. :|) or if you don't know the size of the array.
I hope that made sense.