I have several ways to calculate a value while decreasing preferences.
firstWay() second() + way() orA(thirdWay())
Each of them returns an Option . I want to "combine" them and get an Option whose value is returned first by Some of them, or None if all are returned by None .
Of course, if firstWay() returns a Some , I should not calculate the rest.
What is the most idiomatic (or at least reasonably readable) way to do this?
scala lazy-evaluation scala-option
Paul draper
source share