Calling a Function

Category:Functions

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.

Tips

  • The purpose of a function is to help you organize your code and to avoid writing the same code twice. You can you define a function once, and then call the function a number of times.
  • You can call a function within another function.

Found a bug in the documentation? Let us know at documentation@code.org