Exercise 1: Extract Even Elements from an Array
Explore how to use Ruby blocks to extract even integers from an array. This lesson helps you understand Ruby's block syntax, iterators, and how to apply them for practical problem-solving with arrays.
We'll cover the following...
We'll cover the following...
Problem statement
Extract the even integers from the given array.
Example
input_array contains [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Output is [2, 4, 6, 8, 10]