Functions including parameters and returns

So far, you’ve used and created simple functions that carry out one task in isolation. This type of function is often referred to as a procedure or subroutine. These functions might accept parameters, but they do not return any information to the program that called them.

In this step, you’ll learn more about these two aspects of functions — parameters and return values — and how they make functions incredibly useful.

Just like in the previous step, I’d like you to imagine the function as a machine carrying out a computational task when switched on or called. A simple function or procedure is like a basic machine: it does one fixed task, like a kettle. I turn it on, it does the task, and I receive no real feedback from the machine. Every time this function is called, it carries out its task.