Click here to navigate the course.

Drag the edges to resize the window.

In Projects, you can keep track of your progress as you go throught the tasks. Check each item as you complete it!

Code Editor
Learn
The Refactor Factory

What You'll Be Fixing

We're going to reinforce our knowledge of Ruby best practices by refactoring some existing code. As mentioned, refactoring is the process by which we improve a code's structure, appearance, and/or performance without modifying its overall behavior.

The code in the editor is a Ruby method, first_n_primes, that takes a number n and generates a list of the first n prime numbers. Unfortunately, our poor author hasn't yet mastered all the tools available in Ruby. But we can fix that!

Instructions

Let's get to work and start refactoring this monster of a program!

Report a Bug
If you see a bug or any other issue with this page, please report it here.