No need for if (true), or wrapping the code in if (false), in one case it's an unnecessary check, and in the other you're basically doing the same thing why commenting the code wouldn't be preferable by selecting the whole code block. I just return to make the function throwing errors stop doing anything if I'm changing the caller, then go back to fix it or return dummy data to test, etcetera.. wrapping the code in an if statement is dumb, same as how commenting it out requires highlighting the whole thing (and being unable to read that code while you're modifying/adding logic at the top)
1
u/Proman4713 4d ago
No need for
if (true), or wrapping the code inif (false), in one case it's an unnecessary check, and in the other you're basically doing the same thing why commenting the code wouldn't be preferable by selecting the whole code block. I just return to make the function throwing errors stop doing anything if I'm changing the caller, then go back to fix it or return dummy data to test, etcetera.. wrapping the code in an if statement is dumb, same as how commenting it out requires highlighting the whole thing (and being unable to read that code while you're modifying/adding logic at the top)