title: How do I get an element's index in an Array while iterating?
body: <p>I want to add a method to the ruby class Array. Is it possible to reference the array and its indexes while iterating?</p>
  
  <p>For example, I want to create a method to print elements of array along with their indexes.</p>
  
  <pre><code>array = [:a, :b, :c]
  
  array.print_elements_with_indexes
  # =&gt; a 1, b 2, c 3
  </code></pre>