Relational operators are the operator used for comparing two expressions and yield the result as either True
or False
.
Syntax : expression <relational operator> expression
List of operators
= =
(equal to)<
(less than)>
(greater than)< =
(less than or equal to)> =
(greater than or equal to)! =
(not equal to)
When these operators are applied to strings, strings are compared left to right, character by character, based on their ASCII values.
ASCII : American Standard Code for Information Interchange. It is a code for representing English characters as numbers and vice-versa. ASCII codes of
A - Z
lies in the range [65, 90]a - z
lies in the range [97, 122]0 - 9
lies in the range [48, 57]
Relational operators have lower precedence than the arithmetic operators..
Try out these concepts and play with the operators to understand better. Stay tuned for more!!!