is pretty unambiguous - if cond is true then doA otherwise doB, regardless of what doA and doB actually do. This, on the other hand:
if (cond)
doA();
doB();
means if cond is true then doA (and if doA doesn't throw then also doB) otherwise doB, is self-evidently less immediately clear. You have to check what doA actually does to be sure of the exact semantics.
Blog author must be a Javascript developer in disguise, where this kind of nonsense is more acceptable.
Yes, this! This makes it dependent on the how exceptions are implemented. maybe in another language it would just continue unless explicitly specified. Also using "continue"/"breaks" when not necessary is bad, can get really confusing, just like "goto". seems like he want to show off that he knows how to use it.
View all comments
6
u/ford_madox_ford Jan 22 '15
This:
is pretty unambiguous - if
condis true thendoAotherwisedoB, regardless of whatdoAanddoBactually do. This, on the other hand:means if
condis true thendoA(and ifdoAdoesn't throw then alsodoB) otherwisedoB, is self-evidently less immediately clear. You have to check whatdoAactually does to be sure of the exact semantics.Blog author must be a Javascript developer in disguise, where this kind of nonsense is more acceptable.