Stats

37 Contributors: 4
Monday, October 24, 2016
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook

Comparable

Download ruby eBook

Syntax

  • include Comparable
  • implement the space-ship operator (<=>)

Parameters

ParameterDetails
otherThe instance to be compared to self

Remarks

x <=> y should return a negative number if x < y, zero if x == y and a positive number if x > y.

Related Examples