From: "Abinoam Jr." Date: 2011-01-18T14:11:29+09:00 Subject: Re: Calling by Reference - Two Questions On Tue, Jan 18, 2011 at 12:34 AM, Gary Wright wrote: > They both work.  Remember that myswap!(a) changed the array to [5,2] and so myswap2! changes it back to [2,5]. > > Gary Wright Exactly. One more thing, in the first try with myswap the returned value is being ignored. > > myswap a # => [5,2] (new object) > > puts " myswap #{a} #{a.object_id} " myswap 25 27431650 Assign the returned value to a variable. b = myswap a Now b is the "swap" of a and they have different object_ids. Abinoam Jr.