Can we like type if statement with 2 condition. For example - if (int > 60) ( int < 70 ) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can we like type if statement with 2 condition. For example - if (int > 60) ( int < 70 )

pls tell

13th Dec 2017, 5:48 AM
Aditya Gupta
Aditya Gupta - avatar
3 Answers
+ 6
No ,u can't as u written; If you want to check more than one condition,you have to use Logical operators; Logical operators are mainly used to control program flow. Usually, you will find them as part of an if, a while, or some other control statement. The Logical operators are: > op1 && op2-- Performs a logical AND of the two operands. > op1 || op2-- Performs a logical OR of the two operands. > !op1-- Performs a logical NOT of the operand. The concept of logical operators is simple. They allow a program to make a decision based on multiple conditions.  :)
13th Dec 2017, 6:19 AM
ㅤ Tweetu 😆 ㅤㅤ
ㅤ  Tweetu 😆 ㅤㅤ - avatar
+ 1
thanks
13th Dec 2017, 11:06 AM
Aditya Gupta
Aditya Gupta - avatar
- 1
You can also write them out: op1 and op2 op1 or op2 not op1
13th Dec 2017, 10:07 AM
Timon Paßlick