From: Brett Simmers Date: 2007-07-31T02:16:26+09:00 Subject: Re: array.include? Do you need the order of the items to be preserved? If not, you should think about using a Set instead of an Array. You could then use Set#add, which accomplishes the same thing and is MUCH faster, especially if your data set gets fairly large. Array#include? has to do a linear search over the entire Array, but most operations on Sets are constant time, including Set#add, Set#add?, and Set#include? Brett Jeffrey Bowen wrote: > if @status_array.include? @status_number > else > @status_array << @status_number > end > > I'm using the above to append an array if it does not > include @status_number. Is there an include?-not > function that would eliminate the else? Or another > way to do the same thing? > > Jeff > > > > ____________________________________________________________________________________ > Got a little couch potato? > Check out fun summer activities for kids. > http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz > > >