From: Robert Klemme Date: 2007-11-20T21:41:29+09:00 Subject: Re: is there an nicer way for this expression? 2007/11/20, Remco Hh : > hi, > perhaps a stupid question. > > i do this a lot: if (foo.bar==1 or foo.bar==2) > > can i make this expression shorter and nicer?, > something like if (foo.bar=1,2), which of course doesn't work :) # note: if you do this frequently you should probably # put the array in a constant to save the array # creation overhead if [1,2].include? foo ... or case foo when 1,2 ... else end Kind regards robert -- use.inject do |as, often| as.you_can - without end