Lesson 7: Basic Function

In the sixth lesson, we generalized our code in order to be able to rotate our stitch around it's corner. Now we want to take our code and put it into a function, and take the key parameters within that code and rework them as arguments to that function. Now we can draw a stitch just by executing this function with values for the size, position, number of lines and rotational angle.

Having put our code to draw a single stitch into a neat function, we can now easily start creating more elaborate patterns. For example, here I have called this function 4 times. The only thing I change for each of these four calls of that function is the rotational angle that we input to that function. This gives us a cool-looking 4-pointed-star pattern.