Why doesn't 0 (Fixnum) support .each ?
1 does, so does 2, 20, 200, and so on.
Why not 0? Why doesn't 0.each simply do something 0 times?
NYARGH!
Why doesn't 0 (Fixnum) support .each ?
1 does, so does 2, 20, 200, and so on.
Why not 0? Why doesn't 0.each simply do something 0 times?
NYARGH!
Lady Michelle Bhaal wrote:
Why doesn't 0 (Fixnum) support .each ?
1 does, so does 2, 20, 200, and so on.
Why not 0? Why doesn't 0.each simply do something 0 times?NYARGH!
Probably a bug.
1#each doesn't exist either.
You're probably thinking of #times, which *is* defined for 0, 1, 2, ...
In article <4382D1B8.9010202@corax.com.au>, Lady Michelle Bhaal wrote:
Why doesn't 0 (Fixnum) support .each ?
1 does, so does 2, 20, 200, and so on.
Why not 0? Why doesn't 0.each simply do something 0 times?
Hi,
At Tue, 22 Nov 2005 17:07:25 +0900,
Lady Michelle Bhaal wrote in [ruby-talk:166943]:
Why doesn't 0 (Fixnum) support .each ?
Because Fixnum doesn't have the method `each'.
1 does, so does 2, 20, 200, and so on.
All of them don't.
--
Nobu Nakada
Why doesn't 0 (Fixnum) support .each ?
1 does, so does 2, 20, 200, and so on.
They don't, because they're single items, not lists, sets or something.
Why not 0? Why doesn't 0.each simply do something 0 times?
Because 0.times { } does that.
alternatively, Range#each works.