Example: Relational operators in expressions
These are the examples of relational operators in expressions.
Symbol (Function) | Description | Example: If tag1 = 5 and tag2 = 7, then: |
== (Equal to) | Compares the two values and returns a 1 (true) if they are equal. Returns a 0 (false) if they are not equal. Performs a case-sensitive string comparison. All values are converted to double-precision floating point first, and then the operation is performed. | tag1 == tag2 is false, so the expression returns 0 |
!= (Not equal to) | Compares the two values and returns a 1 (true) if they are not equal. Returns a 0 (false) if they are equal. All values are converted to double-precision floating point first, and then the operation is performed. | tag1 != tag2 is true, so the expression returns 1 |
< (Less than) | Compares two values and returns a 1 (true) if the value on the left is smaller than the value on the right. Returns a 0 (false) if not. All values are converted to double-precision floating point first, and then the operation is performed. | tag1 < tag2 is true, so the expression returns 1 |
> (Greater than) | Compares two values and returns a 1 (true) if the value on the left is larger than the value on the right. Returns a 0 (false) if not. All values are converted to double-precision floating point first, and then the operation is performed. | tag1 > tag2 is false, so the expression returns 0 |
<= (Less than or equal to) | Compares two values and returns a 1 (true) if the value on the left is smaller or the same as the value on the right. Returns a 0 (false) if not. All values are converted to double-precision floating point first, and then the operation is performed. | tag1 <= tag2 is true, so the expression returns 1 |
>= (Greater than or equal to) | Compares two values and returns a 1 (true) if the value on the left is larger or the same as the value on the right. Returns a 0 (false) if not. All values are converted to double-precision floating point first, and then the operation is performed. | tag1 >= tag2 is false, so the expression returns 0 |
Provide Feedback