Comparison with the "Greater Than" and "Greater Than or Equal to" Operator - 04

With the Greater Than Operator

The greater than the operator (>) compares the values of two numbers. If the number to the left is greater than the number to the right, it returns true. Otherwise, it returns false.

Like the equality operator, the greater than the operator will convert data types of values while comparing.


Examples

5   >  3
7   > '3'
2   >  3
'1' >  9

In order, these expressions would evaluate as true, true, false, and false.



With the Greater Than or Equal to Operator

The greater than or equal to the operator (>=) compares the values of two numbers. If the number to the left is greater than or equal to the number to the right, it returns true. Otherwise, it returns false.

Like the equality operator, the greater than or equal to the operator will convert data types while comparing.

Examples

6   >=  6
7   >= '3'
2   >=  3
'7' >=  9

In order, these expressions would evaluate as true, true, false, and false.



Post a Comment

Previous Post Next Post