On Wednesday 20 August 2008, IƱaki Baz Castillo 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.

if [1,2,3,4].include? num

It's not that different, but it looks more like English.

Stefano