title: Ruby min max assignment operators
body: <p>When programming ruby I always find myself doing this:</p>
  
  <pre><code>a = [a, b].min
  </code></pre>
  
  <p>This means compare <code>a</code> and <code>b</code> and store the smallest value in <code>a</code>. I don't like writing the code above as I have to write <code>a</code> twice.</p>
  
  <p>I know that some non-standard dialects of C++ had an operator which did exactly this </p>
  
  <pre><code>a &lt;?= b
  </code></pre>
  
  <p>Which I find very convenient. But I'm not really interested in the operator as much as I'm in the <em>feature of avoiding repetition</em>. I would also be happy if I could write</p>
  
  <pre><code>a.keep_max(b)
  </code></pre>
  
  <p><code>a</code> can be a quite long variable, like <code>my_array[indice1][indice2]</code>, and you don't want to write that twice.</p>
  
  <p>I did alot of googling on this and found no result, hopefully this question will pop up and be useful for others aswell.</p>
  
  <p>So, is there any non-repeitive way to express what I want in ruby?</p>