Ruby - Enumerable and Collection Processing
What will be the output of this Ruby code?
arr1 = [4, 5, 6] arr2 = ['x', 'y'] result = arr1.zip(arr2) puts result.inspect
arr1 = [4, 5, 6] arr2 = ['x', 'y'] result = arr1.zip(arr2) puts result.inspect
zip with unequal lengthszip fills missing elements with nil.arr1 has no pair, so paired with nil.nil in last pair [OK]15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions