I have been scouring the internet for an answer and can't seem to make it work. I'm pretty new using Ruby so please be patient. I am trying to write a program that asks user to choose how many arrays they want to create and that automatically create and name these arrays.
Here's what I have so far, please assume that the user will just input an integer. So if the user types 3 it will create myArray1, myArray2, myArray3
puts 'how many arrays do you want to create?'
number_of_arrays = gets.chomp.to_i
(1..number_of_arrays).each do |i|
myArray+"#{i}" = Array.new
end
I am aware that myArray+"#{i}" = Array.new doesn't work but I am trying to find a way to do that, any suggestions and help is welcomed. Thank you!