Introduction to Functions
Get an overview of what will be covered about functions in this chapter.
We'll cover the following
Overview
There are a number of useful concepts that we, as programmers, should always follow. One is to write code that is easy to read and understand. Another is to avoid duplicating code. When you start out your career as a programmer, you’ll find yourself copying and pasting code and just changing some small things here and there. This is not an ideal practice because it nullifies the first concept of writing code that’s easy to read. Reading more or less the same lines over and over is tedious and it can be hard to spot the tiny differences.
A better solution is to package code that we want to reuse several times into a function. A function is a way for us to give a name to a block of code and then, with this name, the code block can be called over and over every time we want it to execute.
Get hands-on with 1400+ tech skills courses.