Introduction To Ruby
Comparison Operators

Comparison operators are used in Boolean expressions (expressions which evaluate to either true or false) when we want to test things in our programs.

DescriptionIn Ruby
Equal to==
Less than<
Greater than>
Not equal to!=
Less than or equal to<=
Greater than or equal to>=

In addition to the comparison operators, the boolean operators, NOT, AND, OR can also be used in boolean expressions.

! (num < 30)num is not less than 30
num > 5 && num < 30num is greater than 5 and less than 30
num < 5 || num > 30num is less than 5 or num is greater than 30