A function is just a bit of code that is reusable. Think of it like a set of tasks packaged up. If you ever find yourself writing the same bit of code over and over again all over the place in your script, stop! and write a function instead. You’ll be glad you did.
Let’s take a real life example of a task that we have to do regularly to see how these things work. Later, we’ll cover a programming example for working out a percentage.