array = ["andy", "eric", "bloc"] array.each_with_index do |element, index| puts "The index of #{element} is #{index}" end # => The index of andy is 0 # => The index of eric is 1 # => The index of bloc is 2