From: Lionel Bouton Date: 2007-07-26T04:06:53+09:00 Subject: Re: Question - Passing parameters by reference Chris Thiel wrote the following on 25.07.2007 20:56 : > I believe it's adding & in front of the argument in a method in C++ to > get > pass by reference. > void add_one(&num) { > num++ > } > > Is there something that's equivalent in ruby? Ruby always pass references. The problem is that "number += 1" is expanded as "number = number + 1". The problem here is that Fixnum#+ doesn't modify the object but generates another one. So in fact it generates what happens is that a new Object is created and then is referenced by number, but not by n. To make it work like you want you would need to only use methods that modify the object itself, which AFAIR don't exist in this context. Lionel.