Loops allow us to repeat the same steps of code as many times as we desire without having to type that code multiple times.
A danger of loops that that a poorly coded loop can last forever. So we always wish to include a condition in the loop that will cause it to stop. The condition can be for the loop to run a specific number of times, or to keep running until a specified event occurs.
In the code below, the word
whilecreate the condition.
while period < finalperiodlimit do lineargrowth = 1.0 ∗ period
exponentialgrowth = Math.exp(period)