Hi Jason, great article congratulations.
By the way, i did not see anything commenting about this so there it go, you can clean even more replacing the 3 ifs with a single switch using multiple case validation like this;
I build things with my hands. The human behind Shift - https://laravelshift.com, master of Git - https://gettinggit.com, and author of "BaseCode" - https://basecodefieldguide.com
The original code (from Part 1) was a switch statement. Personally, I don't find switch statements very readable. Especially with conditions in the case.
Hi Jason, great article congratulations.
By the way, i did not see anything commenting about this so there it go, you can clean even more replacing the 3
ifs
with a singleswitch
using multiple case validation like this;`
let me know what you think.
The original code (from Part 1) was a
switch
statement. Personally, I don't findswitch
statements very readable. Especially with conditions in thecase
.Cool!
I prefer "switch" because i like to write
return true
only one time. 😁