Created
June 25, 2013 14:24
-
-
Save vuorejo1/5858852 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def triangle(a, b, c) | |
kolmio = Array.new | |
kolmio = [a, b, c] | |
if kolmio.size.uniq == 1 then | |
return :equilateral | |
elsif kolmio.uniq.size == 2 then | |
return :isosceles | |
elsif kolmio.uniq.size == 3 then | |
return :scalene | |
end | |
end |
judofyr
commented
Jun 25, 2013
def triangle(*args)
case args.uniq.size
when 1; :equilateral
when 2; :isoceles
when 3; :scalene
end
end
def triangle(*args)
[:equilateral, :isoceles, :scalene](args.uniq.size-1]
end
/runs away
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment