title: Simple way to test if multiple variables have same value, ruby
body: <p>Is there a simple way of testing that several variables have the same value in ruby?</p>
  
  <p>Something linke this:</p>
  
  <pre><code>if a == b == c == d #does not work
     #Do something because a, b, c and d have the same value
  end
  </code></pre>
  
  <p>Of course it is possible to check each variable against a master to see if they are all true, but that is a bit more syntax and is not as clear.</p>
  
  <pre><code>if a == b &amp;&amp; a == c &amp;&amp; a == d #does work
      #we have now tested the same thing, but with more syntax.
  end
  </code></pre>
  
  <p>Another reason why you would need something like this is if you actually do work on each variable before you test.</p>
  
  <pre><code>if array1.sort == array2.sort == array3.sort == array4.sort #does not work
      #This is very clear and does not introduce unnecessary variables
  end
  #VS
  tempClutter = array1.sort
  if tempClutter == array2.sort &amp;&amp; tempClutter == array3.sort &amp;&amp; tempClutter == array4.sort #works
     #this works, but introduces temporary variables that makes the code more unclear
  end
  </code></pre>