-1
我使用的問題here代碼。我收到以下錯誤,
Example test : example1 - RUNTIME ERROR (tested program terminated unexpectedly)
Output:
user.rb:113: syntax error, unexpected $end, expecting keyword_end
example2 - RUNTIME ERROR (tested program terminated unexpectedly)
Output:
user.rb:113: syntax error, unexpected $end, expecting keyword_end
example_grouped - RUNTIME ERROR (tested program terminated unexpectedly)
Output:
user.rb:113: syntax error, unexpected $end, expecting keyword_end
下面是代碼,
def check_triangle (_array)
for p in 0 .. _array.length-1
for q in p .. _array.length-1
for r in q .. _array.length-1
return true if _array[p] + _array[q] > _array[r] && _array[p] + _array[r] > _array[q] && _array[r] + _array[q] > _array[p]
end
end
end
return false
end
爲什麼你使用'for'而不是'each'?看到這很不尋常。儘管你粘貼的是有效的Ruby。據我所知,沒有任何錯誤。 – tadman
這不能是真正的代碼。真實的代碼有113行。這個問題是由你沒有透露的行引起的。 – matt