0
我正在研究IronRuby中的一些東西,但我遇到了一些障礙。這個代碼塊:IronRuby對each_for_index有問題嗎?
def func
b = @b
b.each_with_index do |element, index|
<some stuff in here>
end
end
提供了以下錯誤:
./myfile.rb:<line number>:in 'func': wrong number of arguments (0 for 1) (ArgumentError)
from IronRuby.Libraries:0:in '<EachWithIndex>b__9'
from IronRuby.Libraries:0:in 'each'
from IronRuby.Libraries:0:in 'Each'
from ./myfile.rb:<line number>:in 'each_with_index'
from ./myfile.rb:<line number>:in 'func'
難道我做錯了什麼嗎?我正在使用IronRuby 1.0(.NET 2.0版本)。這可能顯得很荒唐,但我一直無法找到答案。
作爲一個說明:我已經在那裏拋出了一堆put語句,而b肯定是一個Array,所以它不像我試圖對它不應該工作的東西做這件事。