MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/mwcaao/ternary_operators_at_their_maximum_potential/gvi29is/?context=3
r/badcode • u/SpeckyYT sadistic • Apr 22 '21
73 comments sorted by
View all comments
7
I thought the rule for ternary was have only two things compared not even sure what this would return
23 u/fukitol- Apr 22 '21 The else clause of every ternary operator here is another ternary operator. It'd work, but everyone would hate you and make fun of you for this. 6 u/CrepuscularSoul Apr 22 '21 Basically yeah. I love ternary for simple one line if else stuff, I might let a second nested one slide if it's formatted for readability, but beyond that I'm not approving that PR.
23
The else clause of every ternary operator here is another ternary operator. It'd work, but everyone would hate you and make fun of you for this.
6 u/CrepuscularSoul Apr 22 '21 Basically yeah. I love ternary for simple one line if else stuff, I might let a second nested one slide if it's formatted for readability, but beyond that I'm not approving that PR.
6
Basically yeah. I love ternary for simple one line if else stuff, I might let a second nested one slide if it's formatted for readability, but beyond that I'm not approving that PR.
7
u/INTO_NIGHT Apr 22 '21
I thought the rule for ternary was have only two things compared not even sure what this would return