Re: Re[2]: [SMARTY] switch statement ?
| From: | Andrei Zmievski | Date: | Mon, 29 Apr 2002 13:33:18 +0000 |
| Subject: | Re: Re[2]: [SMARTY] switch statement ? | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-3922@lists.php.net to get a copy of this message | ||
On Mon, 29 Apr 2002, Bertrand DUNOGIER wrote:
> I'm not a begginer programmer, you know :)
>
> I just notice that i happen to have some
> {if ...}
> ...
> {elseif}
> ...
> {elseif}
> ...
> {else}
> ...
> {/if}
> statements. And this is typically what can be replaced by a switch
> with a good increase in code quality.
Why? Is it an axiom that switch/case leads to inherently better code
quality than an if/else chain? They are pretty much equivalent in my
mind, and the less code constructs we have, the better off Smarty is.
-Andrei
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth