1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 13:24: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-06 18:27:18 +02:00

12 lines
No EOL
603 B
Markdown

---
title: 'Instead of writing repetitive `else if` statements, use an array to look up the wanted value based on the key you have'
tweet_id: '1272822439689555969'
thread_slug: laravel-clean-code-tactics
author_username: samuelstancl
images:
- 'https://pbs.twimg.com/media/EanzWiHXsAAhshs.jpg'
created_at: 2021-04-06T16:07:22+00:00
slug: 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.