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.
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!
07"n must be an integer" unless n.is_a? Integer
09 if n <= 0 then return “n must be greater than 0.”
11 prime_array ||=
13 prime = Prime.new
14 for num in (1…n)
17 return prime_array