Write a Ruby program to concatenate array of arrays into one.
fnums = [ 10, 20, [30, [40, 50] ] ] print "Original array:\n" print fnums nums = fnums.flatten print "\nFlatten array:\n" print nums
Output:
Original array: [10, 20, [30, [40, 50]]] Flatten array: [10, 20, 30, 40, 50]
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer