Ruby - Arrays
What will be the output of this Ruby code?
a = [1, 2, 3, 4, 5] b = [2, 4, 6] result = a - b puts result.inspect
What will be the output of this Ruby code?
a = [1, 2, 3, 4, 5] b = [2, 4, 6] result = a - b puts result.inspect
- operator removes elements in the second array from the first.2 and 4 from [1, 2, 3, 4, 5] leaves [1, 3, 5].15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions