To compare two data values use relational operators
Operator | Description | Example |
---|---|---|
== (equal to) | Checks if the values are equal | (0 == 0) gives true |
!= (not equal to) | Checks if the values are not equal | (0 != 0) gives false |
> (greater than) | Checks if the value is greater | (1 > 0) gives true |
< (less than) | Checks if the value is less | (1 < 0) gives false |
>= (greater than or equal to) | Checks if the value is greater than or equal | (0 >= 0) gives true |
<= (less than or equal to) | Checks if the value is less than or equal | (0 <= 7) gives true |