EZ Programing Demos

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

Links to topics:

Current topic:

Patterned lines

This demo draws a group of vertical lines.

 Slow  Medium  Fast 
Click 'Run' to go.

Here's a diagram showing how this program works:

 

This is why the line segments are vertical:

Whatever x may equal, both endpoints have that same value for their x-coordinate:

 

Notice that in this demo the endpoints for each vertical line segment have the same x-coordinate. That's what makes the line segments vertical. If the segments were horizontal, each endpoint would have the same y-coordinate.

Try changing the y-coordinates in the line command to make the line segments shorter or longer.

In the first line of the demo try changing the starting x-coordinate to move the pattern to the right or left.

Within the body of the repeat loop try changing the value that is added to the x-coordinate to change the spacing between the line segments.

Can you make the line segments be drawn right to left, instead of left to right?

 

Flow chart:

 

Imaginary code for this demo:

    
    x = -5;
    
    repeat(5)
    {
      line(x, 5, x, -5);
      
      x = x + 1;
    }
    

 

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.