I just learned about returned statements. When you have value-returning pgrogrammer defined functions I know that you can return a method like this: return intNum1 * intNum2;

But what if you need to define a variable and store a calculation in that variable How would you return to that method For example:

decimal CalcGross( double dblHours, decimal decRate, int intHOUR_LIMIT)


//declare variables

decimal decGross = 0;

if (dblHours <= intHOUR_LIMIT)


//CALCULATE regular wages

decGross = (decimal) dblHours * decRate;




//CALCULATE regular wages and then CALCULATE overtime

decGross = intHOUR_LIMIT * decRate;

decGross += (decimal)(dblHours - intHOUR_LIMIT) * (1.5M * decRate);

This is my method - CalcGross. What is the line of code I need to return my method Thanks for the help. I tried return CalcGross; which obviosuly doesn't work. Thanks

Re: Visual C# Language return statements

Wole Ogunremi

just before your function exits, add the line below: