The Refactor Factory

$VERBOSE = nil    # We'll explain this at the end of the lesson.
require 'prime'   # This is a module. We'll cover these soon!

def first_n_primes(n)

  puts "n must be an integer." unless n.is_a? Integer
  puts "n must be greater than 0." if n <= 0
  prime_array = [] if prime_array.nil?
  prime =
  for num in (1..n)
  return prime_array


why is it telling me …Remember, you don’t need any 'end’s with one-line ‘if’ and ‘unless’ statements in regards to the lines i have stared. Could some one advise if i am missing something please

Chances are there is no error with those lines, only something else might have gone wrong that the SCT does not have a message for so uses the one it has.

Since this lesson was written there may have been a change in the version of Ruby that is in use, making some the code obsolete or deprecated.

Please post a link to the exercise so we can further test this assumption.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.