Lesson 10: Nested For Loop

In the ninth lesson, we put the for loop to draw our 8-pointed-star pattern into a function called 'drawStar'. In this final lesson we will -- you guessed it -- put that function into another for loop! In fact, this time we will put the function within two for loops in order to create a 2D grid of star patterns. A for loop within another for loop is said to be a "nested" for loop. These two loops will "iterate" over the rows and columns in our grid, and we can easily change the size of our stars in order to generate lots of variations of this pattern.

That's it for this introductory course to programming and drawing stuff in the browser. I hope I've given you a sense of just how powerful the concepts are of using variables, loops and functions to build something that looks complex from something as simple as telling the computer to draw a line between two points. If you have followed this so far, then you are well on your way to being able to program ANYTHING!