March 18 - Working with Infinity in Ruby
Working with infinity can be a unique challenge in many different programming languages. Thankfully Ruby offers a helpful library that allows you to implement infinity into programs, and that's what this guide focuses on.
Guide Tasks
  • Read Tutorial
  • Watch Guide Video
  • Complete the Exercise
Video locked
This video is viewable to users with a Bottega Bootcamp license

Summary

Build a method that utilizes infinity in order to generate a string based collection of any size.

Exercise File

Code File

Exercise Description

Leverage Ruby's Infinity library in order to build a method that generates a collection of string based integers of any size provided by the method argument.

Example

string_infinity_generator 10 # => ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
string_infinity_generator 2 # => ["1", "2"]
string_infinity_generator 20000 # => ["1", "2", ..., "20000"]

Real World Usage

Technically this particular coding exercise could be built by leveraging ranges, which is the common convention. However, there are times, especially when working with mathematical equations that you will discover the need to implement the concept of infinity.

Solution

Can be found on the solutions branch on github.