A relational operator is used to check the relationship between two operands. For example,
Relational operators return “true” or “false” according to the data, if in example 1 if a is greater than b then it returns “True” for that particular expression. There are 6 relational operators:
Operator Symbol | Relational Operation |
---|---|
== | Equal to |
!= | Not equal |
> | Greater than |
< | Less than |
>= | Greater than or equal to |
<= | Less than or equal to |
Expression’s first value = a
Expression’s second value = b for upcoming examples:
Return “true” if the value of "first value" is equal to the value of "second value" else return “false” for the expression.
Return “true” if the value of "first value" isn’t equal to the value of "second value" else return “false” for the expression.
Return “true” if the value of "first value" is greater than the value of "second value" else return “false” for the expression.
Return “true” if the value of "first value" is smaller than the value of "second value" else return “false” for the expression.
Return “true” if the value of "first value" is greater than the equals to the value of "second value" else return “false” for the expression.
Return “true” if the value of "first value" is smaller than equals to the value of "second value" else return “false” for the expression.
|