As I understand it, running a .select method on an array generates a new array. My question is how to reference that new array?
So when I have something like this:
Num = [3, 5, 7, 9, 11, 13, 15, 17, 19]
x = rand(1..10)
Num.select { |i| i > x}
I want to reference specific objects in the new array generated by this .select.
For example, I'd like to say
puts new_array[0]
Or something similar. But since the new array doesn't have a "name," I don't know how to call the objects in it.
Thanks for any help!
new_array = Num.select {|i| i > x}thennew_array[0]etc.new_array = [] new_array << Num.select { |i| i > x}but that added an array within an array. This is so simple. Thanks again.