Overview#
Function is an
implementation of an
algorithm.
Function is a Subroutine that is independent and NOT associated to a Class. (Unlike a Method)
A typical Function is described by:
Dependent variable = function (Independent variable)
Function is a combination of instructions that are combined to achieve some result.
Function typically requires some input (called arguments) and returns some results.
For
example, consider the example of driving a car. To determine the mileage, you need to perform a calculation using the distance driven and the amount of fuel used. You could write a Function to do this calculation. The arguments going into the function would be distance and fuel consumption, and the result would be mileage. Anytime you want to determine the mileage, you simply call the Function.
Function#
There might be more information for this subject on one of the following: