As an example of a modifier, consider increment, which adds a given number of seconds to a Time object. Again, a rough draft of this function looks like:
Is this function correct? What happens if the argument secs is much greater than 60? In that case, it is not enough to subtract 60 once; we have to keep doing it until second is below 60. We can do that by replacing the if statements with while statements:
The solution above is correct, but not very efficient. Can you think of a solution that does not require iteration? Try writing a more efficient version of increment in the commented section of this active code. If you get stuck, you can reveal the extra problem at the end for help.