From: Tobias Reif Date: 2001-10-31T21:15:11+09:00 Subject: [ruby-talk:23938] Re: References in methods Ralph Mason wrote: > It appears that altering a string in a method does not always alter the > passed in string. Could someone please explain this behavior. ----- def meth01(x) x.gsub(/b/,"a") end def meth02(x) x += "X" end s = "abc" p meth01(s) # -> "aac" p meth02(s) # -> "abcX" ----- HTH, Tobi -- Tobias Reif http://www.pinkjuice.com/myDigitalProfile.xhtml go_to('www.ruby-lang.org').get(ruby).play.create.have_fun http://www.pinkjuice.com/ruby/