Why is it ugly?
&& and || are not meant as control-flow syntax but as operators, so using them for the former will confuse people and just look weird. It aso provides no real benefit when compared to either
&&
||
iAmHungry? bakeAnEgg() : 0
or
if (iAmHungry) bakeAnEgg();
Thanks for the detailed response! This is definitely a good case against using '&&' as an operator.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Why is it ugly?
&&
and||
are not meant as control-flow syntax but as operators, so using them for the former will confuse people and just look weird. It aso provides no real benefit when compared to eitheror
Thanks for the detailed response! This is definitely a good case against using '&&' as an operator.