FUNCTIONS CORE

Payment()

Calculate a periodical payment for loans

Syntax

Signature
Payment( nLoan, nInterestRate, nPeriods ) --> nPayment

Arguments

nLoan

nInterestRate

nPeriods

Example

Payment.prg
PROCEDURE Main()

   LOCAL nMonthlyRate := 0.1 / 12

   Check( 'Round( Payment( 2000, nMonthlyRate, 24 ), 2 ) ', Round( Payment( 2000, nMonthlyRate, 24 ), 2 ), 92.29 )
   Check( 'Payment( 1200, 0, 12 )                        ', Payment( 1200, 0, 12 ), 100 )

RETURN

STATIC PROCEDURE Check( cTitle, xResult, xExpected )

   QOut( cTitle + IIF( xResult == xExpected, "OK", "ERROR" ) )

RETURN

Output

Round( Payment( 2000, nMonthlyRate, 24 ), 2 ) OK
Payment( 1200, 0, 12 )                        OK