The greater than operator
The greater than operator >
is used to check if a value is greater than the other.
It checks if the value to the left of the operator is greater than the value to the right of the operator.
For example:
5 > 3
will result in a boolean True
since 5 is greater than 3.
3 > 5
will result in a boolean False
since 3 is not greater than 5.
The less than operator
The less than operator <
is used to check if a value is lesser than the other.
It checks if the value to the left of the operator is lesser than the value to the right of the operator.
For example:
5 < 3 will result in a boolean False
since 5 is not lesser than 3.
3 < 5 will result in a boolean True
since 3 is lesser than 5.
The greater/less than or equal to operator
We can also use the greater than / less than operator with an equality operator to check if a value is greater/lesser or equal to its right hand side value.