title: Replace a single element in an array
body: <p>I have an array with unique elements. Is there a way to replace a certain value in it with another value without using its index value?</p>
  
  <p>Examples:</p>
  
  <pre><code>array = [1,2,3,4]
  if array.include? 4
  #  "replace 4 with 'Z'"
  end
  array #=&gt; [1,2,3,'Z']
  
  hash = {"One" =&gt; [1,2,3,4]}
  if hash["One"].include? 4
  #  "replace 4 with 'Z'"
  end
  hash #=&gt; {"One" =&gt; [1,2,3,'Z']}
  </code></pre>