------art_7209_33464980.1145462252079
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

@test=[2,4,6,8]

(1..10).each do |n|
if @test.include?(n)
  #execute code
end


2006/4/19, Jake McArthur <jake.mcarthur / gmail.com>:
>
> ar = [1, 2, 3, 4, 5, 6]
> ar.include? 2          => true
>
> On Apr 19, 2006, at 10:45 AM, Dinesh Umanath wrote:
>
> > Hi all,
> >
> > I want to do this manipulation. I have an array say @test=[2,4,6,8].
> > How can i compare a given number against the values which are
> > present in
> > this array? ie.
> >
> > In a for loop i will be Iterating through a sequence of number say
> > 1 to
> > 10, and i want to take each of these number 1 to 10 and check if this
> > number is present in the given array @test, if it is present then i
> > want
> > to execute some sequence of steps, How can i do this check in ruby ?
> >
> > Is there a kind of "in" operator in ruby ?
> >
> >
> > Thank You
> > Dinesh
> >
> >
> > --
> > Posted via http://www.ruby-forum.com/.
> >
>
>
>

------art_7209_33464980.1145462252079--