From: dblack@... Date: 2006-03-04T06:21:53+09:00 Subject: Re: Array comparison returning nil Hi -- On Sat, 4 Mar 2006, Logan Capaldo wrote: > > On Mar 3, 2006, at 3:33 PM, dblack@wobblini.net wrote: > >> However: >> >>>> [1,2,nil,3].join("-") >> => "1-2--3" >> >> so you'd get those extra -'s in one but not in the other if one but >> not the other had nils. > > I doubt he's displaying the result of the join when doing the comparison, it > would still compare whether or not there are double dashes It's not a display thing; it's a <=> or == thing. If the two arrays have unequal numbers of nils, and you join them with "-", the results will not be equal. Actually, I realize now that since he's sorting them, he'll never get that far anyway, because this: [1,2,3,nil].sort won't work at all; nor will ["1", "2", "3", nil].sort. I'll keep my money on the theory that one array contains integers and one contains string representations of the same integers :-) David -- David A. Black (dblack@wobblini.net) Ruby Power and Light (http://www.rubypowerandlight.com) "Ruby for Rails" chapters now available from Manning Early Access Program! http://www.manning.com/books/black