Relational operators
Relational operators
Relational operators are applied in comparison operations, and the result of their application is always a boolean value (true / false). They can be applied to any data type, but in all cases, both operands must be of the same type. It is important to remember some comparison rules:
- When comparing boolean values, the value true is considered greater than the value false.
- For string values, a string is considered greater than another if it is sorted alphabetically after the other.
| Operator | Explanation | Unary / Binary |
|---|---|---|
> | Compares the operands on both sides of the operator and returns true when the left operand is greater than the right one. | Binary |
>= | Compares the operands on both sides of the operator and returns true when the left operand is greater than or equal to the right one. | Binary |
< | Compares the operands on both sides of the operator and returns true when the left operand is less than the right one. | Binary |
<= | Compares the operands on both sides of the operator and returns true when the left operand is less than or equal to the right one. | Binary |
= | Compares the operands on both sides of the operator and returns true when both are equal. | Binary |
<> | Compares the operands on both sides of the operator and returns true when both are different. | Binary |