On Aug 20, 2008, at 5:32 PM, Iñáki 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.
>
> --  
> Iñáki Baz Castillo

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

if (1..4) === num

Robert might chime in with an inject version, so I won't do one of  
those.

-Rob

Rob Biedenharn		http://agileconsultingllc.com
Rob / AgileConsultingLLC.com