Functions - 2017
A function is a module of code that performs a given task on data passed to it as parameters, this block will then return a value back. Furthermore functions can be called throughout your program and even in other functions once they are written.
In this sense, a function is a type of procedure or routine. Some programming languages make a distinction between a function, which returns a value, and a procedure, which performs some operation but does not return a value. Most programming languages come with a prewritten set of functions that are kept in a library.
Example of a function
private double CalculateRandomValue(int BaseValue, int Variability)
{
return BaseValue - (BaseValue * Variability / 100) + (BaseValue * Rnd.Next(0, (Variability * 2) + 1) / 100);
}
As you can see the function above is from the Warren class, it specifies the data type (after private) and must have a return command to pass the value back.