0
When I call a method it can return some integer value if I use "int" instead of "void" in line 1 (see code below). I can store the returned value in a variable or use it in another method.
Consider this code in C#:
public int Sum(int a, int b)
{
return (a + b);
}
public void Main(string[] args)
{
int v1 = 4;
int v2 = 7;
// Store the returned value in a variable named result1
int result1 = Sum(v1, v2);
Console.WriteLine({0}, result1);
// Output: 11
// New values for v1 and v2
v1 = 5;
v2 = 3;
// Even you can use the returned value as a parameter for another method (consider types conversion)
int result2 = Sum(result1, Sum(v1, v2));
// First Sum(v1, v2) return 8 so I can use that value for the second Sum(result1, 8) where 8 is the value returned by Sum(v1, v2) (consider this value is integer because Sum() return integer values, if Sum() return string I need convert string to int)
Console.WriteLine({0}, result2);
// Output: 19
}
(I use Google Translate, sorry)