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 B. 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.
Hi,
At Tue, 22 Nov 2005 17:07:25 +0900,
Lady Michelle B. 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.
In article [email protected], Lady Michelle B. 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?
1#each doesn’t exist either.
You’re probably thinking of #times, which is defined for 0, 1, 2, …
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.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs