From: Alex Young Date: 2007-08-08T23:22:33+09:00 Subject: Re: case statement Shai Rosenfeld wrote: > Alex Young wrote: >> Shai Rosenfeld wrote: >>> end >>> >>> ((i.e, whatever value is included in the array)) >>> ...how do i do this? >> Does the Array#include? method do what you need? Perhaps a more >> fleshed-out example might help? > > Array#include is EXACTLY what i need, but syntaxtetically (if u get the > drift) i'm not sure how to do it: > > case [3, 45, 6, 'abc'].inlcude? > when 1: 'no good' > when 3: 'good!' > when 'lolo': 'no good' > end I'm not sure why you're using case here. I'd do it like this: [3, 45, 6, 'abc'].include?(var) ? "good" : "no good" -- Alex