Functions in C#

Functions or Methods are an essential part of programming any software, see whenever we code we have to follow a simple principle of DRY: Don't Repeat Yourself because it increases code quality and saves a lot of time and functions/methods are basically a block of code which we can use anytime we want without repeating ourselves.

There are 2 steps to create and use a method and it is to first create the method and then to make the method work we call it.

<access-modifier><return-type>FunctionName(<parameters>) {
    // Code
}

Example

public static void printName(string name) {
    // Code
}
public static int SomeFunction(int n) {
    return n;
}