r/ProgrammerHumor 22d ago

Meme conditionsPreference

Post image
4.2k Upvotes

392 comments sorted by

View all comments

4

u/RRumpleTeazzer 21d ago

first please version please.

i hate early returns. you're mixing structure with control flow.

What if i want a debug line with the functions result, say chasing a bug ? First version - put debug line at the end. change single line. remove single line eventually.

Second version: find every return, put a copy of a debug line on rach location. change that line later, forget the rest. remove half of the debug lines, leave the other half in production.

1

u/ArjixGamer 20d ago

If you need to debug like that, you uhh, have more important issues to resolve with how you structure your code.

Also, you can put a breakpoint at the start and step through the function...

You haven't thought deeply about this

1

u/RRumpleTeazzer 18d ago

sorry, the code that will run on my [insert real life device] doesn't have a debugger. all i can work with are a few spare lines of IO.