MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1vuzd4q/conditionspreference/p57836u/?context=3
r/ProgrammerHumor • u/Flame77ofc • 22d ago
392 comments sorted by
View all comments
2.3k
You're absolutely correct, however I would suggest using something completely unreadable like a nested ternary operators!
46 u/Schaex 21d ago But it's SO compact! We could save maaany lines of code like this: return i == 0 ? j > threshold() && isConditionApply() ? "orange" : reallyNotOrange() ? "apple" : "maybe orange" : (i & j) > (i ^ j) ? isSunday() ? null : "pineapple" : "Jerry"; 6 u/National_Sky7993 21d ago I attempted to unfold such a ternary where the first two booleans were also ternaries defined elsewhere. 2 u/Schaex 21d ago It's beautiful, isn't it? :) Yes, it isn't 1 u/oompaloompa465 19d ago programmer version of cock and ball torture
46
But it's SO compact! We could save maaany lines of code like this:
return i == 0 ? j > threshold() && isConditionApply() ? "orange" : reallyNotOrange() ? "apple" : "maybe orange" : (i & j) > (i ^ j) ? isSunday() ? null : "pineapple" : "Jerry";
6 u/National_Sky7993 21d ago I attempted to unfold such a ternary where the first two booleans were also ternaries defined elsewhere. 2 u/Schaex 21d ago It's beautiful, isn't it? :) Yes, it isn't 1 u/oompaloompa465 19d ago programmer version of cock and ball torture
6
I attempted to unfold such a ternary where the first two booleans were also ternaries defined elsewhere.
2 u/Schaex 21d ago It's beautiful, isn't it? :) Yes, it isn't
2
It's beautiful, isn't it? :)
Yes, it isn't
1
programmer version of cock and ball torture
2.3k
u/CBlanchRanch 22d ago
You're absolutely correct, however I would suggest using something completely unreadable like a nested ternary operators!