loading...

re: There's no "else if" in JS VIEW POST

TOP OF THREAD FULL DISCUSSION
re: LOL I guess technically, if statements could have been omitted in this example (though there’d still be a conditional present). function wow(arg)...
 

I believe you misunderstand what “design flaw” means. The necessity to choose between "LOVELY" and "CUTE" inside a single function in the aforementioned example is already a problem.

One cannot overcome a poor design issues just re-writing this single function in a weird way.

Can you provide an example of a good solution please!

Can you state the problem to be solved in the first place? There is no silver bullet, nor a pill. I just stated that every single problem might be better solved without ifs.

Actually I didn’t misunderstand. I was really just having a little coding fun at your expense because I disagree with your statement. Personally, I believe that anyone that states something along the lines of “never do xyz no matter the circumstance” (not your exact words, I know) has a flawed approach to design and development. Decision/branching is a normal part of what we do. Whether you use an if statement or some other form becomes trivial in the grand scheme. I agree that it is not always the best way but equally disagree that it is always wrong.

code of conduct - report abuse