Mega Code Archive

 
Categories / Ruby / Language Basics
 

A Full List of Number Comparison Operators in Ruby

Comparison     Meaning  x > y          Greater than. x < y          Less than. x == y         Equal to. x >= y         Greater than or equal to. x <= y         Less than or equal to. x <=> y        Comparison.  c              Returns 0 if x and y are equal, 1 if x is higher, -1 if y is higher. x != y         Not equal to.