0

How we can add two condition in one if function

26th Dec 2018, 6:48 PM
Naveed Naveed
Naveed Naveed - avatar
4 Réponses
+ 2
I believe you are thinking of the and statement which is represented in c++ by the "&&" If (firstCondition && secondCondition){ /*something will happen if both conditions are met*/ }
26th Dec 2018, 7:09 PM
Paul
+ 2
Use logical operators: if((x>=3)&&(x<=8)) for example is true then x greater or equals 3 and less or equals 8
26th Dec 2018, 7:10 PM
Igor Kostrikin
Igor Kostrikin - avatar
+ 1
Well, you can always use &&. I'm not sure what you're asking here, though :)
26th Dec 2018, 7:09 PM
selwyn406
selwyn406 - avatar
+ 1
You can use && if you want the two condition corect, or use || if you want either of the two condition is correct, :)
27th Dec 2018, 4:18 PM
Emmanuel Bagus Pratama Adi Sumitra
Emmanuel Bagus Pratama Adi Sumitra - avatar