In this guide we’ll walk through how to split a nested array based on a conditional equation into two arrays.


Implement a method in Ruby that splits an array into two arrays based on a conditional equation.

Exercise File

Code File

Exercise Description

Given an array, build a method that splits the array into two arrays based on being greater than or less than a specific value.

Sample Input

Invoice =, :total, :category)
google ='Google', 500, 'SEM')
facebook ='Facebook', 1000, 'Social')
linkedIn ='LinkedIn', 200, 'Social')

Expected Output

[500, 1000] # Greater than
[200] # Greater than

Real World Usage

There are many times in a Ruby application that you need to split an array based on a specific filter, this guide tests your knowledge of how to split a collection based on a specific value.


Can be found on the solutions branch on github.


Please enter your comment!
Please enter your name here