As we just saw, we cannot use exceptions if we want to keep our code pure. What are our options for making sure we can signify an error to the caller of our function? We want our solution to have the following features:
Before presenting a solution possessing all those benefits in the next section of the chapter, let's have a look at various ways error management is done in imperative languages.
In order to test the various ways, we will try to implement the
max function we already used a bit earlier: