Iteration

Intro :

When repeatedly drawing shapes at intervals across the canvas we often increment an x or y drawing position.

The two graphical outcomes are quite visually different yet there is only one small Functional Error between them.

The code for the left-hand graphic will generate without a compiler error. However, it will result in a solid shape when a repeated drawing of the same shape is desired.

---------------------------------------------------------------------------->

Iterating across the canvas :

Consider why the different graphical outcomes may be occuring. Why is there a solid line on the left but individual sqaures on the right?

---------------------------------------------------------------------------->

Try it :

Try edit the code to turn a solid line into individual squares across the canvas.

Consider what lines of code might need adding to create the visual difference.

Once you start typing code you can press the 'undo' button to go back a step. Or press the 'revert' button if you want to refresh to the orginal code.

---------------------------------------------------------------------------->
---------------------------------------------------------------------------->

J3n Sykes

GitHub | Back to examples