DEV Community

Discussion on: What do you think about the ternary operator?

Collapse
 
nathanverrilli profile image
nathanverrilli

I fail to see the huge fuss. I like the ternary operator, as it renders quick this-or-that-depending expressions easy and fast. Yes, it can be misused. Of course, I still use GOTO for forward error handling in device drivers. Nowhere else, but the legibility increase over nesting a gagzillion IF statements is significant.

I'm for it, because ...
(A) There are a number of good use cases
(B) Stupid coders code stupid regardless of tools. Restricting
everyone else isn't going to make their code better, but it
does make our code worse.

Collapse
 
shreyasminocha profile image
Shreyas Minocha

Stupid coders code stupid regardless of tools

Good point :)

Collapse
 
de_maric profile image
Dejan Maric

Beautifully said :)