In this exercise you’ll learn how to select the odd elements from an array of integers and return the collection of odd items.
Build a program that filters an array of integers, and returns the odd elements.
The program should take in an array of integers and output a filtered array that only contains the odd integers.
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
[1, 3, 5, 7, 9]
Real World Usage
Being able to filter a list of elements is a common requirement in Ruby programs. Additionally, this solution allows you to utilize a number of built in filtering mechanisms provided by the Ruby enumerable library.
Can be found on the solutions branch on github.