Function with parameters

The parameters are the input values for the function enclosed in (), provided in the function call as arguments. Multiple parameters are separated by , and each parameter must have a data type.

static void showSum(int a, int b)
{
  System.Console.WriteLine(a + b);
}

The following function receives two int parameters and displays their sum.

showSum(5, 10);

Get hands-on with 1400+ tech skills courses.