Functions: name a routine, call it again
Loading…
What you will learn
By the end, you can name a block of steps and call it instead of repeating it.
A baker does not rewrite the whole cake recipe every time. She names it “make a cake” and calls it whenever needed. Code can do the same with functions.
Read the explanation
A function is a named block of code. You write the steps once, give them a name, and then “call” the name whenever you want those steps to run. This keeps code short, clear and easy to fix in one place.
- A function has a name.
- You write its steps once.
- Calling the name runs all the steps again.
