I created an array this way:
arr = Array.new(4, Array.new(4, '*'))
When I try to change one element, for example the first element of the first array:
arr[0][0] = 3
then every first element is changed.
print arr
[[3, "*", "*", "*"], [3, "*", "*", "*"], [3, "*", "*", "*"], [3, "*", "*", "*"]]
Can someone explain why this is happening?