[examples] Update constant and comments.

This commit is contained in:
Alessandro Coglio 2022-08-03 15:06:06 -07:00 committed by Pranav Gaddamadugu
parent 01c158e1ae
commit 9deaa52aa6

View File

@ -2,10 +2,10 @@
function main(capital: u32, public rate: u32, periods: u8) -> u32 {
console.assert(periods < 50u8);
let amount: u32 = capital;
for i:u8 in 0u8..10u8 { // accrue for 10 periods
for i:u8 in 0u8..50u8 { // accrue for max 50 periods
if i < periods {
amount += amount * rate / 100u32; // round down
}
} // skip remaining periods
}
return amount;
}