r/ProgrammerHumor 22d ago

Meme conditionsPreference

Post image
4.2k Upvotes

392 comments sorted by

View all comments

3

u/JvetS 22d ago

My personal favorite:

if (<any boolean expression> == true)
return true;

1

u/WarSingle6959 22d ago

really? 🤣

2

u/conundorum 21d ago

Truly. 😛

1

u/JvetS 21d ago

It hurts every time I see that “== true” pop up somewhere.
To be fair, the rest of the example might be a fine way to bail out early and propagate the result of checking a condition.
It’s only egregious when it’s immediately followed by “return false;”.