At 9:44 PM -0700 8/22/09, Lars Torben Wilson wrote:
Hi Keith,

Glad it works! I'm not sure how inverting the case statement helps you
minimize the code in each case. As both I and Adam showed, you can do
the same thing more efficiently (and IMHO much more readably) like
this:

switch ($sum)
{
    case 8:

       break;
    case 7:
    case 6:
       break;
    case 2:
    case 1:
       break;
    case 0:
       break;
    default:
       break;
}


Additionally, I would argue there's nothing different below other than it's even more easier to read and understand:

switch ($sum)
   {
    case 0:
    break;

    case 1:
    case 2:
    break;

    case 6:
    case 7:
    break;

    case 8:
    break;

    default:
    break;
   }

Cheers,

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to