From: "Kurt M. Dresner" Date: 2003-08-27T02:00:55+09:00 Subject: Re: Array#uniq! The exclamation point usually means that the array is modified in place, and thus its return value should not be the uniquified array, but rather something that can tell you if the array elements were unique, and if not, what elements were responsible. That way, you can say something like: a = some stuff if b = a.uniq! puts "array was unique." else puts "array was not unique: multiple instances of " + b.join(', ') end That is a whole lot better than having to store a copy of the old array and then do set subtraction with the uniquified array. -Kurt On Wed, Aug 27, 2003 at 01:48:14AM +0900, mgarriss wrote: > Anyone know why Array#uniq returns an array in every case and > Array#uniq! returns nil if nothing is removed? I'd prefer it to return > the array in every case but I'm sure my attempt to reduce one line of > code (no flames on this plz, it's just fun) are superseded by some > really important concept I don't know about. :) > > Michael > > >======= End of Original Message =======<