February 18 - Fibonacci Sequence Generator in Ruby
In this guide, we'll walk through how to generate the Fibonacci sequence in the Ruby programming language.
Guide Tasks
  • Read Tutorial
  • Watch Guide Video
  • Complete the Exercise
Video locked
This video is viewable to users with a Bottega Bootcamp license

Summary

Create a method that generates the Fibonacci sequence.

Exercise Description

Build a method that returns an array of the Fibonacci sequence of a pre-defined number of values.

Sample Process

Definition: Characterized by the fact that every number after the first two is the sum of the two preceding ones.

fibonacci 10

Expected Output

[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]

Real World Usage

The Fibonacci sequence is a key sequence utilized in a large variety of mathematical equations. Specifically, due to the rapid growth of the Fibonacci sequence, it's useful when analyzing algorithm performance.

Test Cases

Code File