Computer Science Canada

If Statements

Author:  Aange10 [ Sat Dec 31, 2011 3:54 pm ]
Post subject:  If Statements

I have a question about if statements:

code:

if ( i = 10 and e = 4 and r = 6 then) {
    do stuff
}


If i = 8, will it ever check for e or r?

Author:  Tony [ Sat Dec 31, 2011 4:39 pm ]
Post subject:  RE:If Statements

Most languages will check the second argument only if the first is not enough to determine the outcome of the expression.

http://en.wikipedia.org/wiki/Short-circuit_evaluation

You can check for this yourself, by having the second argument of a boolean expression to perform some observable side-effect.


: