Christian von Kleist wrote:
> Cool!  That's from Rails (not part of Ruby), but there's also 
> each_slice(n):
> 
> require 'enumerable'
> 
> a = [1, 2, 3, 4]
> 
> a.each_slice(2) {|slice| puts slice[0] + slice[1]}

You can also use each_with_index:

users.each_with_index do |user, index|
  puts user
  if index < users.length
    puts users[index + 1]
  end
end
-- 
Posted via http://www.ruby-forum.com/.