Defining Procedures - Lakelands Computing

Title
Go to content
Defining Procedures  (Making your own blocks)
Procedures are a very powerful part of programming, and a higher level programming Skill. They are sections of code that have been given a name and can be called just using that name (click here for more explanation).  They make it easier to follow your program, easier for you to edit it - you just goto the procedure you want to edit, and far easier if you need to repeat part of the program, for example an end game sequence w hich can be triggered from a number of different point.

You have already been using procedures in Scratch - the Say command is a prebuilt procedure to put text on the screen . Most of the Scratch commands are actually procedures. But why be limited by what has been pre made when you can define (make) you can make your own procedures?

The example below shows how you could split a short story into functions to make it more efficient. Another common use is in a quiz where you define the procedure for Correct and Wrong and call them when needed for correct and wrong answers.
All Text copyright Lakelands Academy & Mr T Purslow 2020.
All images copyright free / creative commons unless otherwise stated.
You are welcome to use under a Creative Commons Attribution-nonCommercial-ShareAlike License.
All Text copyright Lakelands Academy & Mr T Purslow 2020.  All images copyright free / creative commons unless otherwise stated. You are welcome to use under a Creative Commons Attribution-nonCommercial-ShareAlike License.
All Text copyright Lakelands Academy & Mr T Purslow 2020.  All images copyright free / creative commons unless otherwise stated. You are welcome to use under a Creative Commons Attribution-nonCommercial-ShareAlike License.
Back to content