Ruby - Enumerable and Collection Processing
Which of the following is the correct syntax to check if all elements in an array are even numbers?
numbers = [2, 4, 6, 8]
# Choose the correct line below
Which of the following is the correct syntax to check if all elements in an array are even numbers?
numbers = [2, 4, 6, 8]
# Choose the correct line below
all?.{ |n| n.even? } correctly tests if each number is even.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions