['a', 'b', 'c', 'd', 'e'].each_cons(3).to_a.each_with_index {|(previous, current, nekst), i|
puts "#{i + 1}. #{previous} - #{current} - #{nekst}"
}
#returns consective elements with their indexes
####################Another way can be this#################
['a', 'b', 'c', 'd', 'e'].each_cons(3).with_index{|array_3,index| p a; p b}