C# Return Statement Explained
In C#, the return statement is used to end the execution of a method and return a value to the caller. When the method reaches the return statement, it will immediately return and pass the specified value to the caller. If the method has a return type of void, the return statement can be used to prematurely end the method’s execution. If the method does not have a void return type, a return statement must be used to return a value.