Lesson 6


#1

Below is my code.I have changed .push into >> as per instructions and Ido'nt remember about " Concatenation and the lesson is not passing
oire '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>>(prime.next)}
prime_array

first_n_primes('10')


#2

first you missing the final "end"
you didn't replace the "prime_array = [] if prime_array.nil?" To " prime_array ||= [] "
And the most important the the concatenation operator like this "<<" Not ">>

`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 ||= []

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

end

first_n_primes(10)`