From: Peter Date: 2004-04-06T04:23:07+09:00 Subject: Re: [bug] Array#fetch weird second argument > While adding a testcase to rubicon for Array#fetch, I discovered that > #fetch takes a second argument. However I cannot figure out what its > purpose are. I have tried with lots of different input. > > server> irb > irb(main):001:0> %w(a b c).fetch(1, 500) > => "b" > irb(main):002:0> %w(a b c).fetch(1, -9) > => "b" > irb(main):003:0> %w(a b c).fetch(1, nil) > => "b" irb(main):004:0> %w(a b c).fetch(10) IndexError: index 10 out of array from (irb):10:in `fetch' from (irb):10 from :0 irb(main):005:0> %w(a b c).fetch(10, 500) => 500 Peter