Codele / Programming basics
Functions
Some jobs come up again and again. A function is a mini-recipe with a name: write the steps once, then call for it whenever you need it.
- A function is a named group of steps. You write it once.
- Defining a function saves the steps. Nothing runs yet.
- Calling a function (its name and brackets) runs its steps, then the program carries on right after the call.
- You can call a function as many times as you like. The steps are never copied out again.
- If the recipe needs changing, change it in one place and every call follows.
Loading the playable lesson…