Build a method that replicates Ruby's
cycle method and iterates through an array a variable number of times, and have the method return an array that contains the full set of elements that were iterated through.
cloned_cycle([1, 2, 3], 3) # [1, 2, 3, 1, 2, 3, 1, 2, 3]
Understanding how arrays work in Ruby is key to working with data collections, which is one of the most fundamental requirements of data-driven applications. This exercise will help you learn how to work with nested collections, add elements to an array, and override the basic looping functionality provided by collections.
Can be found on the solutions branch on github.
I've been a software engineer for the past decade and have traveled the world building applications and training individuals on a wide variety of topics.