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))){
4 ответов
+ 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.
+ 4
is this what you mean?
https://code.sololearn.com/cRCr0wW0SoSO/?ref=app
+ 1
so
(((x>y)||(x>11)) &&((y<x)||(y<4)))
true || false && true || false
so it's true
0
no Jordan I meant how more than one if stick in one line, literally in one expresaion together