From: Grant Hutchins Date: 2007-01-28T20:50:11+09:00 Subject: Re: pass by reference? On Jan 27, 5:34 am, Wolfgang N�dasi-Donner wrote: > >>>>> Code >>>>> > > def modifying(a_param) > a_param = "hi" > end > > def modifying2(a_param=a_value) > a_param = "hi" > end In these two methods, the = sign is an assignment, which changes the memory location of the lvalue to point to the object of the rvalue. > def modifying3(a_param) > a_param[0..-1]= "hi" > end This is actually a method call. It could also be written a_param. []=(0..-1, "hi") . So the difference is that in this example you are actually calling a method on the object that a_param points to. This is due to the syntactic sugar Ruby gives to the method named []= which in this case is defined on String. See http://www.ruby-doc.org/docs/ ruby-doc-bundle/Manual/man-1.4/syntax.html#assign So in all three we are passing by value as you define it.