Thank you so much for your helpful explaination. Now I got the actual concept of return statement. Thank you so much.
Hassan Y Ansari
Posts
-
Not understanding use of return statement in c#. -
Not understanding use of return statement in c#.Thank you so much for your reply. But my question is that when i write statement "return j", it is returning value of j. This part I got but when I write "return 0", why it is not giving answer as 0? As I am new, I am not getting this. Please explain me in a little bit detail. Thank you
-
Not understanding use of return statement in c#.I am new to programming and learning on youtube. I have question in following code: using System; class test { public static void Main() { int i = 0; abc(ref i); Console.WriteLine(i); Console.ReadLine(); } public static int abc(ref int j) { j = 100; return j; } } After running this, I am getting answer 100. But when I change return statement as "return 0", again answer is 100. May I know why? If I am returning 0, method should return 0 value to variable i no? I am new to programming so please explain me in very details. Thank you so much.