title: Change value of array element which is being referenced in a .each loop?
body: <p>How do I get the following to happen: I want to change the value of an array element which is being referenced between pipe characters in a <code>.each</code> loop.</p>
  
  <p>Here is an example of what I want to do, but is not currently working:</p>
  
  <pre><code>x = %w(hello there world)
  x.each { |element|
     if(element == "hello") {
         element = "hi" # change "hello" to "hi"
     }
  }
  puts x # output: [hi there world]
  </code></pre>
  
  <p>It's hard to look up something so general.</p>