Relational
operators determine if one operand is greater than, less than, equal to, or not
equal to another operand.
Operator
|
Description
|
Example
|
==
|
Equal to
|
a==b
returns true if a is equal to b, else false
|
!=
|
Not equal
to
|
a!=b
returns true if a is not equal to b, else false.
|
>
|
Greater
than
|
a>b
returns true, if a is > b, else false.
|
>=
|
Greater
than or equal to
|
a>=b
returns true, if a is >= b, else false.
|
<
|
Less than
|
a<b
returns true, if a is < b, else false.
|
<=
|
Less than
or equal to
|
a<=b
returns true, if a is <= b, else false.
|
>>> a=10 >>> b=12 >>> a==b False >>> a!=b True >>> a>b False >>> a>=b False >>> a<b True >>> a<=b True >>>
No comments:
Post a Comment