Sometimes, we need to perform different actions based on different conditions.
It can be perform with the help of relational operators or conditional operators.
Conditional Operator
Operator
Description
Example
Result
>
greater than.
a=4,b=2 ; a>b
a is greater than b
<
less than.
a=2,b=4 ; a
a is less than b
>=
is greater than or equal to.
<=
is less than or equal to.
==
is equals to.
a=2,b=2 ; a==b
a is equals to b
!=
is not equals to.
a=2,b=4 ; a!=b
a is not equals to b
Relational Operator
Operator
Desription
Example
&&
AND
if both condition true than statement will be execute
||
OR
any one condition true than statement will be execute