The Refactor Factory/ Omit Needless words


My code gives me the error :"(ruby):7: syntax error, unexpected tSTRING_BEG, expecting keyword_end
return if n <= 0 "n must be greater than 0."

$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)

  return unless n.is_a? Integer "n must be an integer."

  return if n <= 0 "n must be greater than 0."
  prime_array ||= []
  prime =
  for num in (1..n)
  return prime_array



The syntax for that can be found in an earlier exercise and it's also shown in the hint


syntax is wrong
1. remove return
2. puts "........" condition...
don't understood feel free to look back

Solution :
replace it


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