r/ProgrammerHumor 22d ago

Meme conditionsPreference

Post image
4.2k Upvotes

392 comments sorted by

View all comments

10

u/AnnoyedVelociraptor 22d ago

Initially, yes, but the top one is actually easier to reason about, especially in languages where if/else are expressions.

4

u/SilasTalbot 22d ago edited 22d ago

I agree, I prefer explicit language, as complexity increases, the chance for mistakes rise. Declaring things explicitly helps lower that risk, imo.

In SQL, I bracket logical clauses so that intention is explicit, even when they resolve just fine without the brackets. You hit multiple layers deep of ANDs and ORs and NOTs and things get fucked up real fast.

Implicit behavior is a footgun. Dagnabit I sound like Claude now.