Ruby - Loops and Iteration
What will be the output of this Ruby code?
arr = [1, 2, 3]
arr.each { |n| puts n * 2 }arr = [1, 2, 3]
arr.each { |n| puts n * 2 }each method passes each element to the block variable n.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions