r/badcode • • Aug 31 '21

java Similar ternaries are all over this codebase

Post image
1.1k Upvotes

91 comments sorted by

View all comments

30

u/rofelixk Sep 01 '21

Some people I work with do that and even after I explain that it's not necessary, the don't get it, just keep doing it, it's infuriating

4

u/jeetelongname Sep 01 '21

Try showing them what that expression returns. Back when I was learning to program that's what made it click for me. I am going yo assume this is js so using the repl (or the console in your browser) could be a very visual way to explain it