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.
Given an array, build a method that splits the array into two arrays based on being greater than or less than a specific value.
Invoice = Struct.new(:title, :total, :category) google = Invoice.new('Google', 500, 'SEM') facebook = Invoice.new('Facebook', 1000, 'Social') linkedIn = Invoice.new('LinkedIn', 200, 'Social')
[500, 1000] # Greater than  # 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.