<note> This is not a program, it is an analogy so don't look too far into it.
Imagine nested for loops like the earth, moon and a satellite going around the moon.
The earth orbits the sun as the moon orbits the earth as the satellite orbits the moon.
for(int i=0; i<100; i++) ///this could be our earth
for(int j=0; j<100; j++) ///this could be our moon
for(int k=0; k<100; k++) /// this could be our satellite
The satellite travels fastest around the moon
the moon takes a longer amount of time
and the earth takes the slowest, 365 days.
So the inner portion will happen the more often than the previous and that one will take iterate more often than the first for loop...
Normally we use nested for-loops to iterate arrays so like:
//this is a square with a width(x) of 10, height(y) of 10
//the int at each index could represent the color at each point
for(int x=0; x<10; x++)
for(int y=0; y<10; y++)
square [x][y] = randomColorGenerator();
This loop would set the square 's color one vertical stripe at a time... basically like:
| | | |
VVVV.............. Until the entire square is colored