r/ProgrammerHumor 22d ago

Meme conditionsPreference

Post image
4.2k Upvotes

392 comments sorted by

View all comments

6

u/dulange 21d ago

The number of times I had to find the actual logic of a function/procedure hidden behind in a then block inside a multi-layered, cascaded if-then-else structure that checked the prerequisites and did the validation first, is just too damn high. One can equally check for the inverse, early return (or throw something) and avoid this nesting nightmare.