RE: [PHP] Re: Function size
| From: | Steven Staples | Date: | Wed, 30 May 2012 14:45:57 +0000 |
| Subject: | RE: [PHP] Re: Function size | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-318033@lists.php.net to get a copy of this message | ||
> Paul,
>
> Are you stating here that compression is a bad thing?
>
> That means you consider this nice:
>
> if ( action == A )
> {
> doA();
> }
> else if (action == B )
> {
> doB();
> }
> else
> {
> doC();
> }
>
> Or perhaps flooded with comments that merely say the same as the code does?
>
> I'd go for
> if(action == A)
> doA();
> else if(action == B)
> doB();
> else
> doC();
>
> or , if it's really that clean, i'd probably go for if(action == A) doA();
> else if(action == B) doB(); else doC();
>
> - Matijn
How about this:
($action == 1? doA():($action == 2? doB(): doC()));
Steve.