+ 1
Can we like type if statement with 2 condition. For example - if (int > 60) ( int < 70 )
pls tell
4 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.Â
:)
+ 1
thanks
- 1
You can also write them out:
op1 and op2
op1 or op2
not op1