The rise and rise of Functions

Oct 15, 2019

When we first get introduced to programming, in addition to variables, conditions, and loops, we meet functions, the fundamental concept that allows us to reuse code, simplify complex tasks, and build modular applications. So, what exactly is a function? How do computers handle functions? Do we even need functions?

Let's start with the most straightforward question. Do we even need functions? Yes!

So, what exactly is a function?

I remember when my parents started including me in house duties. For example, my mom would walk me through how to set up and run the laundry machine. She'd first show me how to sort the clothes properly, by color and then by fabric type. Then she'd ask me to load the machine, choose a suitable program, and press start. Well, that was the laundry function right there. Sorting clothes and loading the machine are all functions as well.

Imagine you’re assembling furniture. Instead of reinventing the wheel with every new piece, you use standardized screws, bolts, and instructions to streamline the process. Similarly, functions in programming let us define a set of instructions once and use them wherever needed, making our code more efficient and organized.

Functions are the enchanting block that holds our ideas and reasoning in the form of instructions.