September 2018
Intermediate to advanced
398 pages
9h 43m
English
Now that we know what Option can do for us, we are going to refactor one of the functions of the retirement calculator that we developed in Chapter 2, Developing a Retirement Calculator, to improve the handling of some edge-case scenarios. If you have not done it yet, please follow the instructions at the beginning of the Chapter 2, Developing a Retirement Calculator, to set up the project.
In RetCalc.scala, we are going to change the return type of nbMonthsSaving. In Chapter 2, Developing a Retirement Calculator, we returned Int.MaxValue if netIncome <= currentExpense to avoid looping infinitely. This was not very robust, as this infinite result could then be used in another computation, ...
Read now
Unlock full access