Comparison Operators
Understanding equality, inequality, and relational operators
Comparison Operators and Data Types
Comparison operators allow you to compare values of variables and expressions. Here are some of them:
>- greater than<- less than>=- greater than or equal to<=- less than or equal to==- equal to
These operators are similar to their mathematical counterparts. For example, > means "strictly greater than", like 100 is strictly greater than 99.
Similarly, < means "strictly less than", like 100 is strictly less than 101.
The operators >= and <= check whether the value of one variable is greater than or equal to the value of another variable. For example, 100 is greater than or equal to 99, and 99 is also greater than or equal to 99.
The == operator is used to check equality of two values. If two variables are equal, this operator returns true, meaning the result of the check is true.