In simple terms, the term function refers to the block of organized, reusable code that is used to perform a single, related action. Functions provide better modularity for your application and a high degree of code reusing.
Functions can be classified into two types – Built in Functions and User defined functions. Every programming language contains a list of functions that can be called upon by using their function names. In such cases, you don’t need to include the code for the function within your program.
If there is a specific task that you want the program to perform, you can create functions within the code and call upon that function anywhere within the scope of the code. This is known as a user defined function.
Example of usage – “As he needed a specific task to be performed in his code, he wrote a custom fucntion within the program, that he could call upon anywhere within its scope.”