Hi Tim - your example is great but I don't you phrased that right. You're saying: Ruby passes objects by reference I think it's: Ruby passes object references by copy Same as Java, like you said. --Dave On Aug 24, 2:15 pm, John Dearden <john.dear... / earthlink.net> wrote: > I am trying to write a method that changes the value of two arguments. > Stripped to the barest essentials, something like this: > > def munge(a) > a = a + 1 > end > > zot = 3 > print zot, "\n" # this should (and does) print '3' > munge(zot) > print zot, "\n" # this should print '4'. We wouldn't be here now if it > did! > > Now, if I try the amend method given by David A. Black, it works as > expected. But it's passing a string object, not an integer. > > Surely there is a way to give a method _something_ so that it can return > values to the caller. Of course, if I only ever had a single value to > return, I could make it the return value, but that's just begging the > question. > > Thanks in advance, > John > -- > Posted viahttp://www.ruby-forum.com/.