On 4/25/2016 11:44 AM, Leon Rosenberg 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 ;-)
Not necessarily. Independent IFs have different semantics from an
if..elseif construct. In your example, they could all be true, and
therefore S will be executed 3 times. In an elseif construct at most
one will be executed.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org