I have this simple "Investment" type with a "lifetime" property:
type Investment = {
PurchasePayment: float;
Lifetime: float;
TaxWriteoff: float;
ResidualValue: float;
}
let CoffeMachine = {
PurchasePayment = 13000.0;
Lifetime = 4.0;
TaxWriteoff = 2000.0;
ResidualValue = 500.0;
}
I would like to iterate over the years of investment and perform some calculations for each year:
for i = 1 to int CoffeMachine.Lifetime do
printf "%i" i
// doSomething
Is there a way to avoid using for loop for that and write it in a more functional style?
Cheers,
Wojtek