Calculate a Loan Amortization Schedule in Larzscript
Simple interest, compound interest, and a full monthly amortization schedule - with exact Money math, not float-drifted cents.
loan.amortize() returns one row per payment period (payment, interest, principal, remaining balance), the same breakdown a real loan statement shows.
larzscript pkg install loan
Code
import "loan" as loan print(loan.simple_interest($1000.00, 0.05, 2)) print(loan.compound_interest($1000.00, 0.05, 12, 2)) let schedule = loan.amortize($10000.00, 0.06, 12) print(len(schedule), "payments") print(schedule[0])
Output
$100.00
$104.94
12 payments
{period: 1, payment: $860.66, interest: $50.00, principal: $810.66, balance: $9189.34}Related
larzloanInterest and amortization calculations, Money-aware→Split a Bill Fairly in LarzscriptDivide a bill among people so it reconciles exactly to the cent - no language other than Larzscript treats this as a stack primitive rather than app-level logic.→Hold Funds in Escrow in LarzscriptHold a payer's funds, then release them to a payee or refund them back - using the language's own wallet and pay keywords, not a bolted-on library.→Rate-Limit API Requests in LarzscriptToken-bucket rate limiting in about 20 lines - cap a caller to N requests with a steady refill rate instead of a blunt fixed window.→