About Lesson
Relational Operators.
A relational operator checks the relationship between two operands. If the relation is true, it returns 1; if the relation is false, it returns value 0.
Relational operators are used in decision making and loops.
Operator |
Meaning |
Example |
Return value |
< |
is less than |
2<9 |
1 |
< = |
is less than or equal to |
2 < = 2 |
1 |
> |
is greater than |
2 > 9 |
0 |
> = |
is greater than or equal to |
3 > = 2 |
1 |
= = |
is equal to |
2 = = 3 |
0 |
!= |
is not equal to |
2!=2 |
0 |