0

Guys how can I integrate two if statements cindition on one line

int x= 10; int y = 5; if ((x > 10 ) || (( y > 5 ) &&( y < x))){

27th Jul 2017, 9:43 PM
Hmmam Babe khuoja
Hmmam Babe khuoja - avatar
4 Answers
+ 4
In this case you can just follow the brackets. if(condition1 || condition2) Ok, so if either of these are true, it is true condition2: (condition && condition) Ok, so if both of these are true, it is true Condition1: is x > 10? Nope, x is 10. false. Condition2: Is y > 5 and y < x? Nope, y is 5. false. false || false = false. Therefore, the if statement is false.
27th Jul 2017, 10:36 PM
Rrestoring faith
Rrestoring faith - avatar
27th Jul 2017, 10:43 PM
Jordan Chapman
Jordan Chapman - avatar
+ 1
so (((x>y)||(x>11)) &&((y<x)||(y<4))) true || false && true || false so it's true
28th Jul 2017, 5:49 AM
Hmmam Babe khuoja
Hmmam Babe khuoja - avatar
0
no Jordan I meant how more than one if stick in one line, literally in one expresaion together
28th Jul 2017, 5:55 AM
Hmmam Babe khuoja
Hmmam Babe khuoja - avatar