Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

11
  • 25
    +1 for When the readability and clearness of code suffers. With many chained operators, just like in your example. The example takes longer to understand than equivalent if/else's. Commented Dec 20, 2010 at 16:44
  • 24
    +1 bravo for the great explanation! Developers don't tend to realise that some things are judgement calls, they want everything to be black and white. It drives me nuts. I've encountered to many people of the opinion "X is evil, lets never use it.". I prefer "X is great if you use it for what it's good at". Commented Dec 20, 2010 at 16:48
  • 56
    It is also evil if it's used: myVar = (someExpression) ? true : false; Aaaaarrgh! Commented Dec 20, 2010 at 17:55
  • 21
    @adamk: Try this for evil: myVar = someExpression ? false : true; Commented Dec 20, 2010 at 22:00
  • 11
    How about (someExpression ? var1 : var2)++ :-) Commented Dec 21, 2010 at 10:42