If-statement with logical OR
- by exiter2000
public class Test{
public static void main(String args[]){
int a = 0;
int b = 1;
int c = 10;
if ( a == 0 || b++ == c ){
a = b + c;
}else{
b = a + c;
}
System.out.println("a: " + a + ",b: " + b + ",c: " + c);
}
}
Ok, this is Java code and the output is
a: 11,b: 1,c: 10
And I believe the C acts same as Java in this case
That is because second condition(b++ == c) would never executed if the first condition is true in 'OR' operator.
There is a "NAME" for this. I just don't remember what it is.
Does anyone know what this is called??
Thanks in advance