Skip to content

Modern Finance DepreciationScheduleIterator

Paul Squires edited this page Oct 19, 2026 · 4 revisions

Home › Finance › Finance › DepreciationScheduleIterator

DepreciationScheduleIterator

Walks a depreciation schedule row by row, for stopping early.

Syntax

it.IsValid( )  it.Value( )  it.MoveNext( )

Examples

#import "std/money"
using money

'' The iterator protocol behind FOR EACH -- walk it by hand to stop
'' early or inspect a window.
dim as DepreciationTerms t = DepreciationTermsMake( DecimalParse( "50000" ).Value( ), _
                                                    DecimalParse( "5000" ).Value( ), 7 )

var s = DepreciationScheduleOf( t, DEPRECIATION_SUM_OF_YEARS_DIGITS )
var it = s.Value( ).GetIterator( )

dim as int32 k = 0
while( it.IsValid( ) andalso ( k < 3 ) )
    print it.Value( ).Period_; " "; it.Value( ).Expense_.ToStringFixed( 2 )
    it.MoveNext( )
    k += 1
wend
print k                                  '' 3

Library: Finance
Category: Finance
Documented under: Nothing Becomes A Keyword
Source: pkg/std/money/findeprec.tiko in the tiko repository.

Clone this wiki locally