Logomation Lesson 11 and 12

Its important to understand the difference between a function definition and a function call.

A function definition begins with the word function followed by the name of the function and parentheses:

Function drawSquare()

Repeat 4

Forward 50

Right 90

Then the definition of the function is indented below it. By itself the function definition does not cause anything to happen.

The order in which statements are executed is call the flow of the program. Repeat loops control the flow of a program. Now you will see that functions also effect the flow of the program.

When a function is called:

drawSquare()

The next statement executed is the first one inside the definition of the function. When the end of the function definition is reached the flow returns to the next statement after the function call.


On your own #11:

Five Stars
draw 5 stars using a function


On your own #12:

Five Squares
draw 5 squares in a row each with a different color fill using a function


Click here to find out what comes next in this cavalcade of programming, who knows when it will end??!!!!

Go back to the Lesson List page