Re: Re: Switch - Case Statement Questions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Nov 16, 2012 10:24 PM, "tamouse mailing lists" <tamouse.lists@xxxxxxxxx>
wrote:
>
> On Fri, Nov 16, 2012 at 12:41 PM, Sebastian Krebs <krebs.seb@xxxxxxxxx>
wrote:
> > Beside this it can be rewritten as
> >
> > switch ((int) (($count-1) / 7) {
> >   case 0: // 1-7
> >   case 1: // 8 - 14
> >   default: // above 15
> > }
>
> Nice code refactoring :) Just a tad obscure for someone coming along
> later

Not only obscure, but depending on the rule being processed could be plain
wrong. It works for the values shown so far, but what if another test is
added to the use case in the future that doesn't fit the clever solution?
Without knowing the intent of the code, it could be a headache to maintain.

Just my 2 cents.

Andrew

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux