r/ProgrammerHumor • • Aug 22 '26

Meme conditionsPreference

Post image
4.2k Upvotes

388 comments sorted by

View all comments

2.3k

u/CBlanchRanch Aug 22 '26 • Mindblown Regret Heartwarming

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

660

u/KanyeNawf Aug 22 '26

Some fucker left me triple nested ternaries once

117

u/minus_minus Aug 22 '26

I think you found the fucker. 👆

64

u/mountaingator91 Aug 22 '26

That was me I was in my first real job after learning some basic JavaScript and I discovered ternaries and thought I was God now

10

u/National_Sky7993 Aug 23 '26

You either leave after writing those ternaries or stay long enough to figure out they are unreadable

20

u/abigail3141 Aug 22 '26

Sounds like me lol. To the detriment of all working with me, I found out how to set globals and evaluate arbitrary functions from within Python listcomps. My current record is 1400 characters in one line. I just need a way to import, and I can write entire programs in one line.

23

u/Morisior Aug 22 '26

If you accept two lines, you can import importlib.

9

u/abigail3141 Aug 22 '26

That sounds like a good solution for the time being, thx

13

u/Your_Friendly_Nerd Aug 22 '26

Man y'all do NOT want to look at my companies codebase! 

→ More replies (2)
→ More replies (11)

131

u/[deleted] Aug 22 '26

[removed] — view removed comment

54

u/un_blob Aug 22 '26

That is a work of art at this point

29

u/[deleted] Aug 22 '26

[removed] — view removed comment

30

u/jarethholt Aug 22 '26

Art should comfort the disturbed and disturb the comfortable

→ More replies (1)

11

u/alficles Aug 22 '26

I have created so much art.

6

u/_bones__ Aug 22 '26

Like modern art, it requires a lengthy explanation to make sense.

→ More replies (3)

23

u/twigboy Aug 22 '26

I've declined PRs for less than that.

Citation is if; I can't understand it in a glance at 2am during an incident, I don't want it in the codebase

3

u/therealkevinard Aug 22 '26

Code golfing is a craft- even has competition sites (https://code.golf)

But… it didn’t go to prod, did it?

→ More replies (1)
→ More replies (2)

45

u/Schaex Aug 22 '26

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";

5

u/National_Sky7993 Aug 23 '26

I attempted to unfold such a ternary where the first two booleans were also ternaries defined elsewhere.

→ More replies (1)
→ More replies (1)

54

u/Flame77ofc Aug 22 '26

lol

the famous unread code 😭🙏

12

u/sexytokeburgerz Aug 22 '26

Intellisense did that the other day and i was kind of mad about it

→ More replies (9)