Skip to content

Instantly share code, notes, and snippets.

@perspectivezoom
Created June 13, 2012 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save perspectivezoom/2927076 to your computer and use it in GitHub Desktop.
Save perspectivezoom/2927076 to your computer and use it in GitHub Desktop.
def triangle(n1,n2,n3)
n1n2 = n1 == n2
n2n3 = n2 == n3
n1n3 = n1 == n3
if n1 >= n2 + n3 || n2 >= n1 + n3 || n3 >= n1 + n2
:invalid
elsif n1n2 && n2n3 && n1n3
:equilateral
elsif n1n2 || n2n3 || n1n3
:isosceles
else
:scalene
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment