From: Kirk Haines Date: 2002-11-10T01:26:04+09:00 Subject: Re: Lighting Rod Eric Armstrong said: > 3) 3.times. > How many times does this execute, really? > I saw one page that said it cycled through > indices 0,1,2,3. Hopefully, that was an error! > (If not, this item definitely belongs on the list > of things every newcomer needs to know!) This one is certainly easy to test for oneself: [root@enigo1 tutorial]# irb irb(main):001:0> 3.times {|d| puts d} 0 1 2 3 irb(main):002:0> 2.times {|d| puts d} 0 1 2 irb(main):003:0> 0.times {|d| puts d} 0 Note that the above is done with Ruby 1.6.7 And this is certainly inconsistent with what is stated in the Pickaxe book: "Iterates block int times, passing in values from zero to int - 1" Kirk Haines