re: We don't need a ternary operator VIEW POST

TOP OF THREAD FULL DISCUSSION
re: I agree with with all your points. But I feel like there's situations where it's arguably clearer than the alternative. Other commenters have men...
 

In many (all?) the languages that have the ternary operator if is a statement (rather than an expression).

In Ruby if is an expression but the language also has a ternary operator ¯\(ツ)

 

And in Kotlin! Although Kotlin doesn't have a ternary operator.

It has the Elvis Operator ?: which behaves like C's ternary operator when you omit the middle value... So it's the same as C#'s coallessing operator (??) but it has a groovier syntax!

code of conduct - report abuse