0

I read there are some positions against short-circuiting for code readability. I do not ask opinions here. I'm asking a list of troubles (if any) someone can encounter if they use short-circuiting like:

variable && dosomething() || dosomethingelse()

or

variable && dosomething() //otherwise do nothing and continue

instead of:

variable ? dosomething() : dosomethingelse(), if (variable) { dosomething() } else { dosomethingelse }

or

variable ? dosomething() : null //or void, 0, 42, if (variable) {dosomething()}

I've read this answer: Omitting the second expression when using the if-else shorthand and I wanted to know more.

AMDP
  • 327
  • 2
  • 12

0 Answers0