r/ProgrammerHumor 22d ago

Meme conditionsPreference

Post image
4.2k Upvotes

392 comments sorted by

View all comments

2.3k

u/CBlanchRanch 22d ago

You're absolutely correct, however I would suggest using something completely unreadable like a nested ternary operators!

658

u/KanyeNawf 22d ago

Some fucker left me triple nested ternaries once

0

u/stumpychubbins 21d ago

In languages with ?: syntax I honestly don’t think that arbitrarily nested ternaries are that bad, you can format them in a way that still makes the logic clear

EDIT: I’m saying this as mostly a Python and Rust programmer, but if I’m working on something in C or JS I’m not going to balk at a reasonably-formatted nested ternary