|
|
|
|
|
by TeMPOraL
1895 days ago
|
|
The only problem here is that you have to do this in the first place. This problem has been solved some 60 years ago with Lisp and `cond` construct, which is even older than `if/else if/else`! Alas, our industry likes to forget history. That said, this isn't some kind of high-level hackery. If it's cleaner than if/else if chain, you should use it. Programming is a profession. A professional is expected to learn and grow. The right answer to seeing a code construct one doesn't understand isn't throwing hands up in the air, but spending the few minutes necessary to figure out what it does. |
|