From: Maxime Guilbot Date: 2007-01-25T12:00:46+09:00 Subject: Re: Array and instance variable problem? Wolfgang, Thanks a lot for your detailed answer. What I meant in my second message, is that when @indexes is a FixNum (not an Array). This code is working as expected: #!/usr/local/bin/ruby require 'pp' class Dummy def initialize @indexes = 1 end def get_next @indexes = @indexes*2 @indexes end def get_next_10 all = [] for i in 0..9 all << get_next end all end def show_id puts @indexes.object_id end end d = Dummy.new x = d.get_next_10 puts '##### show contents #####' pp x puts '##### show @indexes-id #####' d.show_id puts '##### show ids of Array elements #####' x.each{|e|puts e.object_id} The output I got is: ##### show contents ##### [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024] ##### show @indexes-id ##### 2049 ##### show ids of Array elements ##### 5 9 17 33 65 129 257 513 1025 2049 I am curious about this result, why is it not the same behaviour? It's also always the same @indexes which got into the array, right? Thanks a lot for your patience! Maxime. -- Posted via http://www.ruby-forum.com/.