From: Simon ARNAUD Date: 2002-02-27T02:40:18+09:00 Subject: Re: Assignment Rules when you write var1 = "qweqwe" you should think you are writing var1 = String.new("qweqwe"). if you want to replace the string in var1, then you should use something like this var1[0..-1]= "qweqwe" Remember everything in ruby is an obect, even strings and numbers. Even if the interpreter allows reductions like str = "toto" or num = 33, it's nothing else than str = String.new("toto") and num = Fixnum.new(33). Though it's a bit trickier for Fixnum if I understand well. Simon ARNAUD aka Maz On Tue, 26 Feb 2002 08:24:39 +0900 "Sean O'Dell" wrote: > > Then why does this statement: > > var1 = "asdasd" > var2 = var1 > var1 = "qweqwe" > print("VAR2: #{var2}\n") > > ....print out "asdasd" instead of "qweqwe"? If var2 points to var1, > printing out var2 should print the contents of var1, if what you said is > true. > > Sean