MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/mwcaao/ternary_operators_at_their_maximum_potential/gvijkwb/?context=3
r/badcode • u/SpeckyYT sadistic • Apr 22 '21
73 comments sorted by
View all comments
43
My boss hates me using ternary operators - I can see why now.
46 u/EnigmaticHam Apr 23 '21 Ternary statements have a legitimate use - when you have one test condition and always have two branches in your code. But when you've got more than one, just use if else. 1 u/recycle4science Apr 23 '21 Or reconsider your architecture lol 14 u/[deleted] Apr 23 '21 [removed] — view removed comment 0 u/recycle4science Apr 23 '21 Lol fair enough. I didn't really register what exactly you were saying, I was talking about more like what the op posted.
46
Ternary statements have a legitimate use - when you have one test condition and always have two branches in your code. But when you've got more than one, just use if else.
1 u/recycle4science Apr 23 '21 Or reconsider your architecture lol 14 u/[deleted] Apr 23 '21 [removed] — view removed comment 0 u/recycle4science Apr 23 '21 Lol fair enough. I didn't really register what exactly you were saying, I was talking about more like what the op posted.
1
Or reconsider your architecture lol
14 u/[deleted] Apr 23 '21 [removed] — view removed comment 0 u/recycle4science Apr 23 '21 Lol fair enough. I didn't really register what exactly you were saying, I was talking about more like what the op posted.
14
[removed] — view removed comment
0 u/recycle4science Apr 23 '21 Lol fair enough. I didn't really register what exactly you were saying, I was talking about more like what the op posted.
0
Lol fair enough. I didn't really register what exactly you were saying, I was talking about more like what the op posted.
43
u/-IoI- Apr 22 '21
My boss hates me using ternary operators - I can see why now.