Comparison operators make a comparison between two variables or numbers and return a value of True or False. They are most frequently used in conditional statements.
syntax
Operator
Name
Description
Example Syntax
Example Result
==
equal to
see if operand one is equal to operand 2 return True or False
1 == 2
FALSE
!=
not equal to
see if operand one is NOT equal to operand 2 return True or False
1 != 2
TRUE
>
greater than
see if operand 1 is greater than operand 2 return True or False
1 > 2
FALSE
<
less than
see if operand 1 is less than operand 2 return True or False
1 < 2
TRUE
>=
greater or equal
see if operand 1 is greater than or equal to operand 2 return True or False
1 >= 2
FALSE
<=
less or equal
see if operand 1 is less than or equal to operand 2 return True or False