From: hubert@... (Hubert Hung-Hsien Chang) Date: 2002-03-26T05:19:24+09:00 Subject: initialization problem? Can anyone explains what is happening in the following codes? --------------------------- class Hole attr_accessor(:elements) def initialize @elements = Array.new end def be(value) if(value.is_a?(Array)) @elements = value end end def to_s result = "" @elements.each {|x| result = result + "(" + x[0].to_s + "," + x[1].to_s + ")" } return result end end d= Hole.new() d.be([[3,2],[3,4]]) puts d puts puts Hole.new().be([[3,2],[3,4]]) puts (c = Hole.new).be([[3,2],[1,1,4]]) puts c --------------------------------------- (3,2)(3,4) # this, I know. 3 #this output confused me. 2 3 4 (3,2)(1,1) #this, I know