c# return tutorial code example

Example 1: how to return a value in c#

void Start()
    {
        Debug.Log(Message()/*calling the function with its name*/);
    }

    string Message()/*you can make values to functions with () and {}*/
    {
        string message = "Hello world";
        return message;//this says which value will be returned
    }

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)