array.inject(false) do |alternate,element|
  if alternate
     # Your processing
  end
  !alternate
end

On 3/12/06, Tomas Fischer <tomas_fischer99_spamremoveit_ / yahoo.com> wrote:
> Hi,
>
> I've got an array a= [1,2,3,4,5,6] and want to access each second
> element:
> b=[2,4,6]. How is this done in ruby?
>
> I know, that I can use a for-loob and modulo operator, but I think there
> is a "ruby way" of doing this.
>
> Thanks.
> tomas
>
> --
> Posted via http://www.ruby-forum.com/.
>
>