> On Mar 14, 2006, at 3:03 PM, Pavel Smerk wrote:
>> = how can I do 'perlish' a[1] <=> b[1] || a[2] <=> b[2] if I want  
>> compare a and b accordind to some my own rules, i.e. if a[1] == b 
>> [2], "return" a[2] <=> b[2]? In Ruby this is not possible, because  
>> 0 is true.
> 
James Gray wrote:
> We use sort_by() for that:

Or nonzero? ... eg.

    (a[1] <=> b[2]).nonzero? || (a[2] <=> b[2])

--
-- Jim Weirich

-- 
Posted via http://www.ruby-forum.com/.