From: Mike Stok Date: 2002-09-13T09:21:37+09:00 Subject: Re: Multi-level sort idiom? In article <3D812169.58D388D8@managesoft.com>, Clifford Heath wrote: > I was wrong. Interesting behaviour - nice but confusing - I would have > thought that what with operators being mostly implemented as methods, > the result of nonzero? would be returned instead of the result of > a[0]<=>b[0]. Is there a definitive statement of which operators/methods > modify the "last expression executed"? The result of nonzero? does get returned, effectively nonzero? transforms any number except 0 to itself, and 0 is transformed to a false value, nil. 0.nonzero? => nil 1.5.nonzero? => 1.5 (-1.5).nonzero? => -1.5 so (a <=> b).nonzero? will be the result of a <=> b, except in the case when it's 0. Hope this helps, Mike -- mike@stok.co.uk | The "`Stok' disclaimers" apply. http://www.stok.co.uk/~mike/ | GPG PGP Key 1024D/059913DA mike@exegenix.com | Fingerprint 0570 71CD 6790 7C28 3D60 http://www.exegenix.com/ | 75D2 9EC4 C1C0 0599 13DA