Answer to Question #50581 in C# for chinu

Question #50581
The execution goes back to the caller by default, when the last statement in a method is
reached.? Assuming that no return statement is used, do you agree with the preceding statement?
Specify the reason for your answer.
1
Expert's answer
2015-01-30T03:39:29-0500
Answer:
Return statement isused to pass value or reference from the method to the caller (another method).
If there is no return statement in the method it is only means that the method
is used to execute actions without returning any value from it. Also execution
goes back to the caller not only when the last statement is reached – it is
goes back when return statement is reached too and it could be not the last
line in the method. Return statement can be used in the <void> methods to
terminate the execution. Absence of the return statement leads to the fact that
the method will be executed to the last line in it and then the execution goes
back to the caller. Entry point is a method too and the entire program runs
through it by calling another methods and the execution always returns to it
from called methods despite if the return values or not.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS