12.09.2010, 15:41
Okay. you seem to miss the concept. If wanted thing is true, (BTW, by last post you could have understood that i meant > instead of copying my mistake) then one is called, so that
if(3>0 && 4>0) //will return true - YES. And effect is equal to next one.
else if(3<0 && 4<0) //will return false
if(3*4>0) - This too will be called, so both scripts check same thing. They pass only when x and y is both positive or negative making result positive. GOT IT? For you i can note that triple check means that the second example at worst does 3 checks in case of X and Y being < 0 :
if(X>0 && Y>0) - evaluates false and doesn't even go to Y.
if(X<0 && Y<0) - evaluates true with 2 checks.
if(3>0 && 4>0) //will return true - YES. And effect is equal to next one.
else if(3<0 && 4<0) //will return false
if(3*4>0) - This too will be called, so both scripts check same thing. They pass only when x and y is both positive or negative making result positive. GOT IT? For you i can note that triple check means that the second example at worst does 3 checks in case of X and Y being < 0 :
if(X>0 && Y>0) - evaluates false and doesn't even go to Y.
if(X<0 && Y<0) - evaluates true with 2 checks.