Function
esse quam videri
Definition
A funciton is a block of reusable code that performs a single action.
Relevance
Functions are an essential part of programming. The key is to make them reusable to reduce typing the same (or similar) code. Another key is known as the "Single Responsibility Principle" which states each function should only have one responsibility (perform one specified action).
Example
string[] shuffleStringArray(string[] targetArray) // By making the array that will be shuffled an argument, we can send any array of string we want into this function.
{
for(int i = 0; i < targetArray.Length; i++)
{
// Code for shuffling here
}
return targetArray; // Return the shuffled array to wherever the function was called.
}