Ruby Mailing List Mirror
[Q] Array.new - strange behavior
ruby-talk
Mehr_Assaph_Assaph
(Mehr, Assaph (Assaph))
11 May 2004 09:24
1
p “P1”
foo = Array.new(3,[0,0])
foo = Array.new(3) {Array.new}
···
foo.each do |foo1|
p foo1.id
end
Related topics
Topic
Replies
Views
Activity
[Q] Array.new - strange behavior
ruby-talk
3
104
11 May 2004
Array::new
ruby-talk
7
91
25 April 2005
Not supposed behaviour of Array.new(2,[])
ruby-talk
8
122
25 November 2002
Question about behavior of Array.new
ruby-talk
7
128
24 March 2003
Nested arrays
ruby-talk
2
90
22 February 2006