The Refactor Factory/ Omit Needless words

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/ruby-beginner-en-Zjd2y/0/3?curriculum_id=5059f8619189a5000201fbcb#

<In what way does your code behave incorrectly? Include ALL error messages.>
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 = Prime.new
for num in (1…n)
prime_array.push(prime.next)
end
return prime_array
end

first_n_primes(10)

<do not remove the three backticks above>

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
    https://www.codecademy.com/en/courses/ruby-beginner-en-1o8Mb/0/2?curriculum_id=5059f8619189a5000201fbcb

Solution :
replace it

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