chapter twenty four
In the previous lesson, you learned how to use the functions map, flatten, and flatMap to manipulate optional values. In this lesson, you are also going to discover a more readable and elegant way of combining instances of Option thanks to a new type of construct called for-comprehension. You’ll also see how to integrate Boolean conditions to control how values are chained together. Finally, you’ll discover other useful operations implemented for Option, such as isDefined, getOrElse, find, and exists. In the capstone, you will use the function getOrElse on Option to provide an alternative message for your HTTP request when a draw of the game “Paper, Rock, Scissors, Lizard, Spock!” occurs.
