FUNCTIONS CORE
Periods()
Calculate the duration for paying back a loan at fixed interest rate and payments
Syntax
Periods( nLoan, nPayBack, nInterestRate ) --> nDurationArguments
nLoan
nPayBack
nInterestRate
Example
PROCEDURE Main()
LOCAL nMonthlyRate := 0.095 / 12
Check( 'Round( Periods( 4000, 200, nMonthlyRate ), 2 ) ', Round( Periods( 4000, 200, nMonthlyRate ), 2 ), 21.86 )
Check( 'Periods( 1200, 100, 0 ) ', Periods( 1200, 100, 0 ), 12 )
Check( 'Periods( 4000, 20, nMonthlyRate ) ', Periods( 4000, 20, nMonthlyRate ), -1 )
RETURN
STATIC PROCEDURE Check( cTitle, xResult, xExpected )
QOut( cTitle + IIF( xResult == xExpected, "OK", "ERROR" ) )
RETURNOutput
Round( Periods( 4000, 200, nMonthlyRate ), 2 ) OK
Periods( 1200, 100, 0 ) OK
Periods( 4000, 20, nMonthlyRate ) OK