1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 21:34:03 +00:00
laravel-tips/content/tips/instead-of-writing-repetitive-else-if-statements-use-an-array-to-look-up-the-wanted-value-based-on-the-key-you-have.md
2021-04-07 20:16:47 +02:00

603 B

title tweet_id thread_slug author_username images created_at slug
Instead of writing repetitive `else if` statements, use an array to look up the wanted value based on the key you have 1272822439689555969 laravel-clean-code-tactics samuelstancl
https://pbs.twimg.com/media/EanzWiHXsAAhshs.jpg
2020-06-16T09:24:52+00:00 instead-of-writing-repetitive-else-if-statements-use-an-array-to-look-up-the-wanted-value-based-on-the-key-you-have

The code will be cleaner & more readable and you will see understandable exceptions if something goes wrong. No half-passing edge cases.