You are browsing posts tagged ruby. Get the rss feed here.

  • Ruby Koans FTW

    Just started learning Ruby… killing it!

    def triangle(a, b, c)
      s = [a,b,c].sort
      equal = [(a==b), (b==c), (c==a)]
      fail TriangleError if s[0] + s[1] <= s[2]
      return :equilateral if equal.all?
      equal.any? ? :isosceles : :scalene
    end