Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@electrineer agreed. While writing, it's look like something good but while reading kind of break the flow.
BTW I use it too. -
Because it easily gets out of control into 7 levels deep pit of ternaries for a single return.
It's okay to use it now and then, but anything more than that and code will soon enough become a pit of snakes -
theuser47815yTo me, they are most suited for conditional assignment, otherwise I would use if else
-
I think it depends which language you're using. It's OK in js if the condition and the return values are simple but other languages make it too verbose for readability.
-
Ternary in java is god sent . Ternary/Elvis in kotlin is outrageous . (Basically whole kotlin is , i hate kotlin)
-
@odite I didn't think about that. Lol.
Anyway, there's an issue lately in our office, since I'm slightly triggered haha. This newly hired non dev (front-end dev's wife) has a MAJOR DRAMATIC ISSUE to me (the only dev babe lol) on how I approach to front-end guy. Well, I treat the team equally like normal devs and just take their green jokes like any other conversation, smiles to team, and get back to work. I don't know why I'm an eyesore to her.
Probably why so. -
@electrineer @shiv7071007 okay. But, by just looking the whole condition it's just so understandable. Just used it for single ternary (@jkuhl) and yes, @theuser for conditional assignment.
Anyway, I appreciate how co-dev improves a lot =)
Related Rants
I don't really get it why my co-male dev does not like ternary operator as a shorthand operator for if/else statements.
rant
wk190