3 ms·
Many languages solve that with pattern matching, like in Haskell: case f <...> of Nothing -> -- Handles the problem values Just m -> -- do
by marcosdumay 8y ago
Many languages solve that with pattern matching, like in Haskell:
case f <...> of
Nothing -> -- Handles the problem values
Just m -> -- do stuff with m
This is, honestly, much better than an assignment expression. Side-effect expressions always bring problematic cases.