title: A more elegant solution to Ruby Koans' triangle.rb
body: <p>I have been working through Ruby Koans and made it to about_triangle_project.rb in which you are required to write the code for a method, triangle.</p>
  
  <p>Code for these items are found here:</p>
  
  <p><a href="https://github.com/edgecase/ruby_koans/blob/master/koans/about_triangle_project.rb" rel="nofollow noreferrer">https://github.com/edgecase/ruby_koans/blob/master/koans/about_triangle_project.rb</a></p>
  
  <p><a href="https://github.com/edgecase/ruby_koans/blob/master/koans/triangle.rb" rel="nofollow noreferrer">https://github.com/edgecase/ruby_koans/blob/master/koans/triangle.rb</a></p>
  
  <p>In triangle.rb, I created the following method:</p>
  
  <pre><code>def triangle(a, b, c)
    if ((a == b) &amp;&amp; (a == c) &amp;&amp; (b == c))
      return :equilateral
    elsif ((a == b) || (a == c) || (b == c))
      return :isosceles
    else
      return :scalene
    end
  end
  </code></pre>
  
  <p>I know from reading Chris Pine's "Learn to Program" there is always more than one way to do things. Although the above code works, I can't help but think there is a more elegant way of doing this. Would anyone out there be willing to offer their thoughts on how they might make such a method more efficient and compact?</p>
  
  <p>Another thing I am curious about is why, for determining an equilateral triangle, I was unable to create the condition of (a == b == c). It is the proof for an equilateral triangle but Ruby hates the syntax. Is there an easy explanation as to why this is?</p>