I expect the solution not to be based on the obvious pattern matching of if-else. I’m sure there should be more natural ways to do it, like combination of map and getOrElse on Option.
I expect the solution not to be based on the obvious pattern matching of
Share
Validationhas afoldmethod that can be co-opted to produce side effects: