From: Kaldrenon Date: 2007-08-08T23:14:59+09:00 Subject: Re: case statement On Aug 8, 10:05 am, 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 > > (the above doesn't work. it's gives a 'not enough arguments' error. how > do i do it correctly?) > -- > Posted viahttp://www.ruby-forum.com/. include? takes an argument x, and is called on a collection n, so that if n.include?(x) it returns true. http://www.whytheluckystiff.net/ruby/pickaxe/html/ref_c_array.html#Array.include_qm