나는 코안에 대한 다음과 같은 해결책을 내놓았다.왜이 작동하지 않습니다 - 루비 코 안
# and
# about_triangle_project_2.rb
#
def triangle(a, b, c)
driehoek = Array.new[ a, b, c].sort
raise (TriangleError), "length cannnot be 0 or lesser" if (driehoek[0] <= 0)
raise (TriangleError), "impossible triangle" if (driehoek[0] + driehoek[1] < driehoek[2])
return :equilateral if ((a == b) and (b == c))
return :isosceles if (((a == b) and (b != c)) or
((a != b) and (b == c)) or
((a == c) and (a != b)))
return :scalene if ((a !=b) and (b != c))
end
# Error class used in part 2. No need to change this code.
class TriangleError < StandardError
end
하지만 지금 삼각형 [2,2,2] 내가이 오류 메시지가 표시 사용됩니다
The answers you seek...
wrong number of arguments (3 for 2)
Please meditate on the following code:
./triangle.rb:18:in `[]'
./triangle.rb:18:in `triangle'
사람이 여기에 잘못이 무엇인지 말해 줄 수 있습니까?
Roelof
응답 포인트를 오류로. 다음 번에 코드의 어떤 줄이 # 18인지 알려주십시오. 당신은 또한 전체 코드를 제공 할 필요는 없으며, 질문에만 해당하는 부분 만 – UncleGene