This code could be refactored better without reversing, but with consolidation, I think.
alexxx
Here again. I am not convinced by that simple example. You are weighing yourself in safety where you are not. In productive code you may have a problem enhancing it. A new requirement may bust your final control flow as you exit the method before even notice the rest of the code. As good as it looks. It's not refactoring friendly as long as you go with partial functional and partial imperative style. If you really want to benefit from refactoring you should decide which programming paradigm to use for the code. This code as it is a sequence of if-statements is a hybrid.