DEV Community

Discussion on: Keeping your code clean by sweeping out "if" statements

Collapse
 
ronnewcomb profile image
Ron Newcomb

Makes me sad when that gets called "clever". "Mapping A B C to X Y Z by using a Map object? Too clever!!" Good grief. I'd fail the else if chain in code review and suggest the switch statement. Map is ok too.

But the article title had me anticipating ternary expressions and array.filter(lambda) as well.

But even with, I don't think of if statements as unclean, just that there's more succinct ways of doing some of the more common things that they're used for.