EZ Programing Demos

Slow motion, step by step, animated demonstrations of basic computer programing techniques

Links to topics:

Current topic:

Repeat within repeat

This is like doing something twice, three times. The 'doing something twice' part would be called the inner loop. And doing that 'three times' would be called the outer loop. So this is a loop within a loop.

 Slow  Medium  Fast 
Click 'Run' to go.

Where is the outer loop?

Where is the outer loop body?

Where is the inner loop?

Where is the inner loop body?


1, 1 2 3

2, 1 2 3

3, 1 2 3

4, 1 2 3

There, I counted the times that I counted to 3. I counted to 3 a total of 4 times. This is quite a bit like a repeat loop within a repeat loop. Here my outer loop has 4 cycles, and my inner loop has 3 cycles.

Nested loops like these are handy for looking at data organized in rows and columns. The outer loop could sweep through all of the rows, top to bottom. And for each row an inner loop could sweep left to right through all the columns. In this way each piece of data could be examined.


Here's the flowchart for this nested loops demo:


Imaginary computer language code for this program could look like this:



Suggested next article:

At EZ Math Movie

EZ Math Movie is a site that can help you experiment with and understand many topics in mathematics. Its main feature is an interactive animated (x, y) graph that you control with an actual programing language. There are many examples and tutorials, and EZ Math Movie is crossed referenced with both EZ Programing Demos and Zona Land Education.


Zona Land Education is a site with explanations and interactive diagrams covering many topics in physics and mathematics. Zona Land Education is cross referenced with EZ Math Movie, and it contains several animations that use EZ Math Movie's programing language.