Q:

Write a Ruby program to create a new array of length 4 containing all their elements from two array of integers, length 2

0

Write a Ruby program to create a new array of length 4 containing all their elements from two array of integers, length 2

All Answers

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

def check_array(a, b)
   arr1 = a[0], a[1], b[0], b[1]
   return arr1;
end
print check_array([1, 3], [5, 4]),"\n"
print check_array([11, 3], [5, 21])  

Output:

[1, 3, 5, 4]
[11, 3, 5, 21]

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