I don't under stand return types for methods

what is it returning variables multiple variables or what

Hi Mark,

Methods with a return type which is not void do not return variables but values. What they return is defined by the return type in the method signature.

http://zetcode.com/lang/csharp/methods/

can I get an example

The return keyword just returns the value you feed it wether that be a variable or a hard coded value the simplest example would be a function that squares an integer:

int Square(int x)
{
      return x * x;
}

By calling the method you’re asking it to do some work and to return the results. I hope that makes more sense.

ok I think I get it know

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms