2 ms·
Often its better to have 5 pieces of code that look alike, then to have a function that has 5 different cases. And the former will be easier to modify and delet
by z3t4 7y ago
Often its better to have 5 pieces of code that look alike, then to have a function that has 5 different cases. And the former will be easier to modify and delete.
- buzzkillington 7y agoNot when you modify state in the same scope. You now have 5! (120) ways of introducing bugs, if you just wrote it as a function that doesn't modify global state you only have 5 ways of creating bugs.