From: ChrisH Date: 2007-02-13T02:25:06+09:00 Subject: Re: == operator - How does it work? On Feb 12, 12:09 pm, Bharat Ruparel wrote: > I am running the following code from Programming Ruby book on page 120: ... > puts song1 == song1 > > It is printing true for the puts song1 == song2 statement. How are > these two song objects equal? Note you have 'song1 == song1' which is of course true. Based on the implementation of the spaceship op (<=>) and the inclusion of Comparable, song2 has a longer duration so is "greater than" song1 HTH Chris