Check this out, this is the weirdest thing ever. Playground: https://play.crystal-lang.org/#/r/77qb/edit
I did not want to use custom methods to create a Matrix because of
Array.new. That’s why I tried to do it this way, but for some reason if you change one Array in the Matrix, all of those arrays get modified??
def create_matrix_for_inventory(r, h) temp = Array(Array(Int32)).new h.times do |i| temp << Array.new(r, 0) end temp end Inventory = Array.new(5, Array.new(7, 0)) #Inventory = create_matrix_for_inventory 4, 7 Inventory = 44 pp Inventory ## WTF LOL??