I have two questions about the following module.
a) What TYPE should I give the function? This is my first function and Option Strict is telling me that I need an 'As' clause for it.
b) I want dblMonths to be an optional argument with a default value of 60. How might I go about this?
Module MonthlyPayment
Public Function Calculate(ByVal dblAmount As Double, ByVal dblRate As Double, ByVal dblMonths As Double)
Dim dblPayment As Double
dblPayment = dblAmount * (dblRate / 12) / (1 - 1 / (1 + dblRate / 12) ^ dblMonths)
Return dblPayment
End Function
End Module
a) What TYPE should I give the function? This is my first function and Option Strict is telling me that I need an 'As' clause for it.
b) I want dblMonths to be an optional argument with a default value of 60. How might I go about this?
Module MonthlyPayment
Public Function Calculate(ByVal dblAmount As Double, ByVal dblRate As Double, ByVal dblMonths As Double)
Dim dblPayment As Double
dblPayment = dblAmount * (dblRate / 12) / (1 - 1 / (1 + dblRate / 12) ^ dblMonths)
Return dblPayment
End Function
End Module