# Leesson 5

#1

Here is my code but it is not passing showing pop-up that it has taken too long
\$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 "n must be an integer." unless n.is_a? Integer

return "n must be greater than 0." if n <= 0

prime_array = [] if prime_array.nil?
end
prime = Prime.new
n.times{prime_array.push(prime.next)}
prime_array

first_n_primes('x')

#2

I know it's late, but try this:

prime = Prime.new
n.times {prime_array.push(prime.next)}

#3

it didn't work .. would you tell the right one?

#4

Hi here

``prime_array = [] if prime_array.nil?``

You missing the `||` before your `=` and remove the if statement so this part should be like that

``prime_array ||= []``

Then put your end after the prime_array like that

``````prime_array ||= []

prime = Prime.new
n.times {prime_array.push(prime.next)}
prime_array
end``````

And your call function should have a number insid it liKe that for example 10.

``first_n_primes(10)``