declare function in c# code example
Example 1: function in c#
//function example
using System;
public class Program
{
static void function(){
Console.WriteLine("I am a function!");
}
public static void Main()
{
function();
}
}
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)