> hi guys,
>
> was wondering the syntax of how to do this:
>
> case [1,2,3,4]
>
> when 1: 'this is what i want'
> when 11: 'not result'
> when 15: 'no good'
>
> end
>
> ((i.e, whatever value is included in the array))
> ...how do i do this?

Strange problem you have here... What if array includes all: 1,11,15?
What the result should be?

>> choices = {1 => 'this is what i want', 11 => 'not result', 15 => 'no good'}
>> data = [1, 2, 3, 4]

>> data.inject([]){|result, k| result << choices[k]}.compact

=> ["this is what i want"]


Regards,
Rimantas
--
http://rimantas.com/