note 120687 deleted from control-structures.switch by peehaa
| From: | peehaa@php.net | Date: | Wed, 22 Feb 2017 09:20:53 +0000 |
| Subject: | note 120687 deleted from control-structures.switch by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208779@lists.php.net to get a copy of this message | ||
Note Submitter: stanislav dot eckert at vizson dot de
----
I always recommend to add curly braces between "case" the "break" (if multiple
code lines are used inside). This has the advantage that many text editors can highlight a vertical
line to show visually where the case begins and where it ends. It also allows in many editors to
"collaps" case statements, which you currently don't need to see. And it generally
improves code readability. I personally don't know any editor which can collaps cases of a
switch statement withouth curly braces. And it's often a pain to read foreign code with
switch-case statements with hundreds of lines (especially since the lines are often not correctly
indented.