From: Florian Frank Date: 2003-08-27T02:30:15+09:00 Subject: Re: Array#uniq! On 2003-08-27 01:48:14 +0900, mgarriss wrote: > Anyone know why Array#uniq returns an array in every case and > Array#uniq! returns nil if nothing is removed? Array#uniq! modifies the receiver, you should not rely on the objects that are returned. However, if the receiver was really changed, uniq! returns a true (not false and not nil) value. You can code something like that: if ary.uniq! puts "Made it unique: " + ary.inspect else puts "Was already unique: " + ary.inspect end I wonder if it would be better to return an instance of TrueClass because I think a lot of people will code mistakes like that: new_ary = ary.uniq! new_ary.each do |x| # ... end Perhaps this works most of the time, but it's just waiting for a disaster to happen. -- Will the virus impact my Macintosh if I am using a non-Microsoft e-mail program, such as Eudora? If you are using an Macintosh e-mail program that is not from Microsoft, we recommend checking with that particular company. But most likely other e-mail programs like Eudora are not designed to enable virus replication. -- http://www.microsoft.com/mac/products/office/2001/virus_alert.asp