Q:

Write a Ruby program to concatenate array of arrays into one

0

Write a Ruby program to concatenate array of arrays into one.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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]

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now