DEV Community

Discussion on: If-Else or Switch-Case: Which One to Pick?

 
pinotattari profile image
Riccardo Bernardini • Edited

A good reason to avoid this construct is readability: the typical "switch" construction is turned upside-down with a constant as "controlling value" and non-constant cases. ...and this flip gets you... nothing?

It is interesting as study case, as "look what you can do" but I cannot see a reason (read: a real advantage) to use it in a real case and the disorientation that causes to the reader is a big disadvantage.