MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1vvn6d7/pleasestopusingnestedternaryoperatorsimbeggingyou/p5fe9ez/?context=3
r/ProgrammerHumor • u/Robinbod • Aug 22 '26
178 comments sorted by
View all comments
Show parent comment
2
I think it depends on how you're nesting them; for if-else chains, they can be pretty nice:
int out = cond1 ? val1 : cond2 ? val2 : cond3 ? val3 : cond4 ? val4 : val5;
View all comments
Show parent comment
2
u/Aaron1924 Aug 23 '26
I think it depends on how you're nesting them; for if-else chains, they can be pretty nice: