On 4/25/16, 10:44 AM, "Leon Rosenberg" <rosenberg.l...@gmail.com> wrote:


>On Mon, Apr 25, 2016 at 5:21 PM, Dougherty, Gregory T., M.S. <
>dougherty.greg...@mayo.edu> wrote:
>
>>
>>
>> Yes, we do, because, well, it is more informative. :-)
>>
>> if (a) Š
>> else if (b) Š
>> else if (c) Š
>>
>> Says you have three mutually exclusive options, and implies that a is
>>more
>> likely / more important than b, than c.
>>
>> Or, if ³a" is a method call, possibly that ³a² has some setup needed for
>> ³b² and ³c².
>>
>> All of this is lost with multiple if statements.
>>
>>
>> Then there¹s the everlasting wisdom of Knuth¹s comment about "premature
>> optimization is the root of all evil².
>>
>
>Exactly my point.
>if (a) Š
>if (b) Š
>if (c) Š
>
>shorter and therefore easier than the other one ;-) if-else-if is just a
>premature optimization to the above statement ;-)

No, they’re different statements.

Your code says “any or all of these three options can occur.” But you’ve
told us that is not correct, only one can occur.

So while the code you provide is clean, it is not correct.

Greg


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to