3 ms·
The big difference is that the first function may be be wrong, but the second is quite obviously wrong. The smallest odd of a list of numbers > 9999 is not 999
by JackFr 3y ago
The big difference is that the first function may be be wrong, but the second is quite obviously wrong.
The smallest odd of a list of numbers > 9999 is not 9999.
The smallest odd of an empty list is 9999 is not 9999.
The smallest odd of a list of even numbers is not 9999.
The first function does seem easier to understand but relies on global state (is_end_of_week, is_end_of_month) and side effecting functions (run_payroll).
Neither of these functions should survive code review.