On Wed, Aug 20, 2008 at 2:32 PM, Iñáki Baz Castillo <ibc / aliax.net> wrote: > Hi, AFAIK in Ruby the only (or the "coolest") way to do something as: > > if num in [1,2,3,4] > > is by doing: > > if [1,2,3,4].index(num) > > Is it? any other "cooler" way? Thanks. class Object def in? (other) other.respond_to?("include?") && other.include?(self) end end num.in? [1,2,3,4] martin