When you define a function you give a name to a set of actions you want the computer to perform. When you call a function you are telling the computer to run that set of actions.
When you call a function you tell the computer to run the code inside the function definition. Functions are called by placing their blocks anywhere in the program.
The function “switchBackgrounds” is used twice in this program. The function can be called instead of rewriting the blocks of code inside of it each time.
Functions can be called inside other functions. Here, the function “dropOre” calls the function “moveNorthwest” in it so that the compass exposes the ore after creates one in its location.
Found a bug in the documentation? Let us know at documentation@code.org