I'm trying to understand the use of the return keyword at the end of a method.
I made a class to calculate a simple value:
public class Calc {
Decimal monthlyWage = 32;
Decimal callCost = 0.33;
Public Decimal TotalValue(Decimal monthCalls){
Decimal billValue = (callCost * monthCalls + monthlyWage);
Return billValue;
}
}
The class compiles, and I'm executing in anonymous windows like this:
Calc octoberCalc = new Calc();
octoberCalc.TotalValue(46);
I'm trying to use 'system.debug(TotalValue)', but it prompts me an error.
So my questions are:
1 - What does the 'return' keyword mean?
2 - And how can I obtain the total value of this bill?
Thanks in advance!!