From: Marnen Laibow-Koser Date: 2010-01-18T23:47:45+09:00 Subject: Re: basic question: passing a modifiable argument to a routi lalawawa wrote: > When you say that += creates a different object, then are you saying > that when I do > > a = 0 > while a < 1000000 > a += 1 > end BTW, the more idiomatic way of doing this would be something like 1.upto(1_000_000).each do |n| # something end > > it creates a million different objects and garbage collects most of > them? Isn't that horribly inefficient for just doing integer > arithmetic? Actually no. For performance reasons, Fixnums are implemented as singletons in all Ruby environments that I'm aware of. But yes, try playing around with the object_id method and you'll see interesting things. Best, --  Marnen Laibow-Koser http://www.marnen.org marnen@marnen.org -- Posted via http://www.ruby-forum.com/.