Michael S wrote:
"NvrBst" <nv****@gmail.comwrote in message
news:11**********************@o11g2000prd.googlegr oups.com...
>In C# if(exp1 && exp2 && exp3)
Does it evalutate left to right (exp1 -exp2 -exp3)? or right to
left (exp3 -exp2 -exp1)? Or would it execute all of them even if
exp1 turned out to be false?
When I was forced into a VB.NET project I was laughing myself to tears when
I learned about the AndAlso and OrElse keywords.
The short circuit is very practical.
The situation where the second test can not be executed if
the first test does not succeed is very common.
if(x != null && x.something())
But from a puristic point of view, then the alternative
tend to enforce more clear code.
if(a && b.changesomeglobalstate())
Arne