Using functions A function is part of a program that performs a particular task and can be reused. Functions make code easier to read, write, and test. In Scratch, each block is a function, and users can define new blocks. How the program flows When a script is run, Scratch carries out one instruction block at a time, from top to bottom. When the instruction is a function, Scratch remembers its place in the script, and switches to run the instructions
in the function. When the function ends, Scratch picks up the main script where it left off. Functions can be used by multiple scripts, and can accept information for processing.
MAIN SCRIPT RUNS
OTHER SCRIPTS CAN ALSO USE THE FUNCTION AT ANY TIME
SCRIPT CALLS THE FUNCTION
THE FUNCTION BLOCKS RUN
WHEN THE FUNCTION ENDS, THE MAIN SCRIPT PICKS UP AT ITS NEXT BLOCK