Ruby - Enumerable and Collection Processing
Find the error in this Ruby code:
arr = [5, 10, 15]
result = arr.select { n > 5 }
puts result.inspectarr = [5, 10, 15]
result = arr.select { n > 5 }
puts result.inspect{ n > 5 } but does not declare the block variable |n|.|n|, Ruby does not know what n refers to, causing an error.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions