I can’t seem to get mine to work, any thoughts on this one?

The one line logic seems correct as the error comes later.

The error I keep getting is apparently on line 18 below and the error is:

(ruby):18: syntax error, unexpected $end, expecting keyword_end

That is the end for the function, and the end on line 16 is the end of the loop, so what I can’t figure out what it’s expecting - to be sure i tried to add and extra ‘end’ and also tried to remove that ‘end’ on line 18 but no luck.

Any help would be super appreciated.

Thanks!

Here is the full block of code:

01$VERBOSE = nil # We’ll explain this at the end of the lesson.

02require ‘prime’ # This is a module. We’ll cover these soon!

03

04def first_n_primes(n)

05

06

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

08

09 if n <= 0 then return “n must be greater than 0.”

10

11 prime_array ||=

12

13 prime = Prime.new

14 for num in (1…n)

15 prime_array.push(prime.next)

16 end

17 return prime_array

18end

19first_n_primes(10)