DEV Community

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

Collapse
 
cpben profile image
CPBen

I'm sold. Sorry, but a pile of nested if's just isn't readable. Read your code out loud to someone, can they follow it? If (!understand) then {map}
But no matter how neat and clean a table of stacked ? : is, I find those obtuse and hard to follow. I don't really like switch. It works. Anyway, all of this is just personal preference and experience. Sometimes how fast you can get it coded matters more than a small difference in speed or memory.