Using Subroutines - Word Drop
Drop the words into the correct position in the paragraph. Press submit to check your answers.
Drawing the same shape several times makes a program long, because the same lines are typed again and again. A ______ is a named block of code that you can run whenever you need it by writing its name. It removes repeated code and ______ a program, making it shorter and easier to read.
To create one, start the line with the keyword ______, then choose a name for it. The name must be followed by a pair of brackets and end with a ______. The code inside must be ______, because the spaces at the start of each line show which lines belong to the block.
Defining a subroutine does nothing on its own, because its code does not run until the subroutine is ______. To run it, write its name followed by a pair of brackets, as many times as you need. It behaves the same way every time.
Subroutines work well with the rest of the turtle program. Use ______ to lift the pen before moving to a new spot, then pendown to start drawing there, so the subroutine can draw another shape in a new place. A subroutine can also contain a ______, which repeats the same lines inside it, so a repeated shape needs far fewer lines of code.
Log in or sign-up to access the word drop
Don't have a login?
You can still revise this topic