The relational operators are used to compare two values and tell you whether the comparison being made is true or false. For example, in the second line in the table, we are testing to see whether x is less than or equal to y. If it is true, this expression will return a non-zero value (usually 1). If the condition is false, then a value of zero will be returned. Special attention should be paid to the == operator; it is not the same as the = operator.
|Operator||Operation||Example||Result (FALSE=0, TRUE≠0)|
|<||Less than||x < y||1 if x less than y, else 0|
|<=||Less than or
|x <= y||1 if x less than or equal to y, else 0|
|>||Greater than||x > y||1 if x greater than y, else 0|
|>=||Greater than or
|x >= y||1 if x greater than or equal to y, else 0|
|==||Equal to||x == y||1 if x equal to y, else 0|
|!=||Not equal to||x != y||1 if x not equal to y, else 0|
In conditional expressions, any non-zero value is interpreted as TRUE. A value of 0 is always FALSE.