If small numbers are much more frequent, it’s better to return early. Really, you should gather statistics about the numbers the function is called with, and put the most frequent ones at the top.
But this way your buddy in QA can build extra test cases and pay you back when he wins an award for most test cases created or some other corporate nonsense.
You could save about half the code by only listing one boolean value and having the other as a default return at the bottom.
Sometimes my genius is almost frightening.
If small numbers are much more frequent, it’s better to return early. Really, you should gather statistics about the numbers the function is called with, and put the most frequent ones at the top.
This noob even forgot zero
That and all negative values
But this way your buddy in QA can build extra test cases and pay you back when he wins an award for most test cases created or some other corporate nonsense.