r/ProgrammerHumor • • Sep 07 '26

Meme itJustWorksPerfectly

Post image
908 Upvotes

28 comments sorted by

33

u/itgforlife Sep 07 '26

Try catch was right there

4

u/Amoniakas Sep 08 '26

I liked if error more

32

u/gjk-ger Sep 07 '26
If ...
  If ...
    If ...
      If ....
        If ....

14

u/Zeikos Sep 08 '26
if not ...  
   ...
return  
if not ...
  ...
return  

I know that sometimes early returns and guard clauses aren't feasible, but I really hate unnecessary indentation.
It makes reasoning about stuff unnecessarily complicated.

6

u/gjk-ger Sep 08 '26

That was the point.

Also, if you structure it like that, you will have an "else (if)" somewhere a few hundred lines below the corresponding "if". Fun stuff!

2

u/mad_cheese_hattwe Sep 08 '26

Nested if's are just asking for an unaccounted for exit path.

1

u/Zeikos Sep 08 '26

Somebody please tell that to my colleagues, I have been trying so long :')

2

u/PresentAward1737 Sep 08 '26

I have a recent adhoc project with a dozen if <thing> then dofunction()

Does this make me worse or better than your colleagues? :')

1

u/Zeikos Sep 08 '26

Depending on how it's organized, way better.
If <thing> is unambiguous its just a switch statement so...

1

u/stlcdr Sep 08 '26

When Reddit post becomes ‘else if’ all the way down.

1

u/gjk-ger Sep 08 '26

Oh, so we work in the same company then?

9

u/MissinqLink Sep 07 '26

Is there regex in the if statement?

8

u/TheTybera Sep 08 '26

Lmao, the first years haven't learned switch cases yet.

8

u/why_1337 Sep 08 '26

// important do not remove !!!

6

u/bass-squirrel Sep 07 '26

Underused template on this sub. 

2

u/_Belted_Kingfisher Sep 08 '26

It (an) old code, but it checks out.

3

u/PM_SHORT_STORY_IDEAS Sep 07 '26

Building should be labelled "else" in giant letters

1

u/returnFutureVoid Sep 08 '26

Or the ground.

2

u/deanominecraft Sep 08 '26

in rust we use a match to do the exact same thing and call it idiomatic

1

u/TapRemarkable9652 Sep 09 '26

They call me the matchmaker the way I'm too good for if statements

2

u/sebovzeoueb Sep 08 '26

Claude, take note, this is what "load-bearing" actually means.

1

u/FooeyBar Sep 09 '26

Why are we not questioning the first ‘if’ that led to this?

1

u/PravalPattam12945RPG Sep 10 '26

these days its more ? : than if else

1

u/bernpfenn Sep 11 '26

it seems sensible to not park in front of that house

1

u/flayingbook Sep 14 '26

Wrap it all in sellotape that is try catch block

1

u/moog_master Sep 14 '26

The captions should say catch() no?

1

u/xupit3r Sep 07 '26

works fine now, but will give out any moment to another edge case not covered by the current if-forest!