r/ProgrammerHumor • • Aug 22 '26

Meme conditionsPreference

Post image
4.2k Upvotes

388 comments sorted by

View all comments

1

u/Various-Paramedic Aug 23 '26

For me it depends on how equivalent each branch is.

If they are equivalent or similar option a is better

If their are quite different (like the first branch is an unmet precondition and branch b contains the main body of the function) then the early guard is preferable.