I need to know the technical difference between these 2 statements and why it behaves like that:
arr = Array.new(3, "abc")
=> ["abc","abc","abc"]
arr.last.upcase!
=> "ABC"
arr
=>["ABC","ABC","ABC"] # which is **not** what I excepted
On the other hand:
arr = Array.new(3){"abc"}
=> ["abc","abc","abc"]
arr.last.upcase!
=>"ABC"
arr
=> ["abc","abc","ABC"] # which is what I excepted