"Object-oriented programming makes code understandable by encapsulating moving parts; functional programming makes code understandable by minimizing moving parts."
- Michael Feathers
Scala, as a mixed paradigm language, motivates you to reuse the code that you write and, at the same time, expects you to follow the motive behind functional programming. That motive is that your program should be decomposed into smaller abstractions to complete a well-defined task. This can be achieved using functions. A function is nothing but a logical construct that performs a certain task and can be reused as needed.
There are certain ways these functions can be introduced and applied into our programs. There are many reasons why functions can be used in our programs. Functions, well-written with the exact number of needed arguments, with well...