Hello people,

Recently, when I was executing a simple Watir script, I noticed a small 
difference in the behaviour of Ruby.  The code is:

a = 'maloy'
b = a
puts a 
puts b
a.chop!
puts a
puts b 

The output that I expected was:

maloy                                  # value of a 
maloy                                  # value of b 
malo                                    # value of chopped 'a' 
maloy                                  # value of original 'b '

But the output given by Ruby was:

maloy                                  # value of a 
maloy                                  # value of b 
malo                                    # value of chopped 'a' 
malo                                    # value of chopped 'b '

Is the output given out by Ruby correct?  Why should Ruby chop the value of the 
variable 'b' when it was not asked to do that?  (It was asked to chop the value 
of the variable 'a' only).

Thanks for your time,
Vaidyalingam.
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6739&messageID=19392#19392
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to