Ruby - Arrays
Identify the bug in this Ruby code:
a = [1, 2, 3] b = [3, 4, 5] result = a + b - a puts result.inspect
Identify the bug in this Ruby code:
a = [1, 2, 3] b = [3, 4, 5] result = a + b - a puts result.inspect
a + b concatenates arrays, then subtracting a removes all elements from a in the result.b remain: [4, 5].15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions