Collection Alternator Method in Ruby
In this guide you will learn how to build a method using the collection alternator method.
Guide Tasks
  • Read Tutorial
  • Complete the Exercise

Summary

Build a method that returns a new collection that combines and alternates the element of two collections.

Exercise Description

"Define a method using the collection_alternator that returns a new collection that combines and alternates the element of two collections."

Example Data

'arr1 = ['a', 'b', 'c']'
'arr2 = [1, 2, 3]'
-> expect(collection_alternator(arr1, arr2)).to eq(['a', 1, 'b', 2, 'c', 3])

Real World Usage

This exercise will help you learn how to combine different collections of data.

Test Cases

Code File