how to use return in c# code example

Example 1: c# function return

// To create a function with a return value, note the variable
// type in front of the function name and add a return of the
// same type at the end.
static string lastFirst(string firstName, string lastName)
{
	string separator = ", ";
	string result = lastName + separator + firstName;
	return result;
}

Example 2: what is a return statement C#

/*return (C# Reference)
The return statement terminates execution of the method in which it appears and
returns control to the calling method. It can also return an optional value. If
the method is a void type, the return statement can be omitted.*\

//(Basically it means do nothing)