c# write a function method code example
Example 1: How to make a function in C#
public void SayHello(string name)
{
Console.WriteLine("Hello")
}
Console.WriteLine("What is your name?")
string name = Console.ReadLine() ;
SayHello(Adam)
Example 2: how to define a function in c#
//The "void" in this instance refers to the return type of this function
//This function won't have a return value.
void functionName(int parameter) {
//Code you want to run
}
//Calls the code in the function
functionName(Aninteger)