Bug in delete_at?

I think there might be a bug in the way delete_at works.

a = [1,2]
a.delete_at(1)
=> 2
a.delete_at(1)
RangeError: Specified argument was out of the range of valid values.
Parameter name: index
from :0:in delete_at' from (irb):38 from :0:ineval’
from workspace.rb:80:in evaluate' from context.rb:217:inevaluate’
from irb.rb:147:in eval_input' from irb.rb:257:insignal_status’
from irb.rb:146:in eval_input' from ruby-lex.rb:230:ineach_top_level_statement’
from :0:in loop' from c:/IronRuby/lib/ruby/1.8/irb.rb:146:ineval_input’
from c:/IronRuby/lib/ruby/1.8/irb.rb:70:in start' from :0:incatch’
from c:/IronRuby/lib/ruby/1.8/irb.rb:69:in start' from c:/IronRuby/bin/iirb:13 from :0:incatch’
a.delete_at(2)
=>nil

The a.delete_at(1) should return nil, but it is throwing an exception.
Is that correct?

Thanks,
Randall

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs