News for hackers. Stuff that matters.
Re:Push ifs up and fors down by assbuttbuttass on Wednesday November 15, 2023 @07:50PM (#38284558)
I love this advice, moving if statements "up" is something I've observed makes a big difference between code that's fun to work with and easy to maintain, and code that quickly gets unmaintainable. I'm sure everyone's familiar with the function that takes N different boolean flags to control different parts of the behavior.

I think it really comes down to: functions that have fewer if statements tend to be doing less, and are therefore more reusable.

There are no comments on this comment yet.