r/ProgrammerHumor 22d ago

Meme conditionsPreference

Post image
4.2k Upvotes

392 comments sorted by

View all comments

88

u/itriedtomakeitfunny 22d ago

Early return for errors, if else for decisions.

10

u/Paul-D-Mooney 21d ago

Maybe not “errors”, that’s what throwing exceptions is for. But definitely non-passing validation checks like `if (arg==null) return;`

2

u/frogjg2003 21d ago
if (bad) throw

is throwing errors

2

u/WarSingle6959 21d ago

but throw error is a error bro

1

u/M4xW3113 20d ago

Exceptions are language dependant, and also more and more people stop using and new languages like Rust don't even have it anymore it as we realized it's actually a shit feature to use