Robert Klemme wrote: > 2007/8/8, Shai Rosenfeld <shaiguitar / gmail.com>: >> 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? > > You can do it with the other form of "case": > > a = [1,2,3,4] > result = case > when a.include?(1): 'this is what i want' > when a.include?(11): 'not result' > when a.include?(15): 'no good' > end Or the other way around: a = [1,2,3,4] b = 2 result = case b when *a: "yes!" else "no!" end -- Alex