From: Logan Capaldo Date: 2006-03-04T02:44:20+09:00 Subject: Re: Array comparison returning nil On Mar 3, 2006, at 8:37 AM, Julian Gall wrote: > I am comparing two arrays with: > > original_item_ids.sort <=> new_item_ids.sort > > However, this returns nil, which seems to be against the documentation > which says the result will be -1, 0 or 1. Both arrays contain the same > values, alhough in a different order, hence the sort. > > Does anyone know of any circumstance that would cause this? > > Thanks, > > Julian > > -- > Posted via http://www.ruby-forum.com/. > <=> will return nil when a comparision makes no sense eg: irb(main):013:0> a = "a" => "a" irb(main):014:0> b = 2 => 2 irb(main):015:0> a <=> b => nil