My goal is to take each element in multidimensional array, create 12 copies that will be processed (without changing the original value), append the processed values to the array, and repeat if necessary to meet the total number of desired values:
total = 4
arr = Array.new(1) { Array.new(3, 127.5) }
while arr.count < total
tmp = arr
tmp.each do |item|
new_arr = Array.new(12, item)
#processing the 12 arrays I just created would happen here
arr.concat new_arr
puts arr.count
end
end
This portion of the code creates an infinite loop. I can not understand why.