How to reuse switch block labels without goto? How to implement the following code without goto and unnecessary code complexity?