In this chapter, we will dive into the wonderful world of functions. We can look at these as modular building blocks creating powerful and adaptive scripts. By creating functions, we add the code in a single building block isolated from the rest of the script. Focusing on improvements of a single function is a lot easier than trying to improve the script as a single object. Without functions, it is difficult to hone in on problem areas and the code is often repeated, it means that updates need to happen in many locations. Functions are named as blocks of code or scripts within scripts and they can overcome many problems associated with a more complex code.
As we make our way through the chapter, we will cover the following topics:
Passing parameters to functions
Menu using functions