Within a function, each switch branch can be a return. Then you get the benefits:
* Make the original function shorter.
* Give a descriptive name to what you're computing.
* Make the computation reusable.
It's what I find lacking with lambdas: it makes it too easy to forego good refactoring because it makes too easy to write one-off code that in reality will be rewritten many times in different places.