use .each_with_index to print each item times its index ruby code example
Example: ruby iterate over array
# For Ruby
arr = ['a', 'b', 'c']
arr.each do |item|
puts item
end
# For Ruby
arr = ['a', 'b', 'c']
arr.each do |item|
puts item
end