What is wrong with this?


#1

$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)

puts "n must be an interger."unless n== false

puts "n must be grater than 0." if n <= 0

prime_array ||= [] 

prime = Prime.new
for num in (1..n)
  prime_array.push(prime.next)
end
return prime_array

end

first_n_prime(0)


#2

please reply i need so much help


#3

Please provide the error you're getting and the number of the exercise.


#4

Hi - Your code is correct, however you need space before the unless command. I have tested it and when there's no space it gives error on both lines, unless and if conditions. Here's it should be:

puts "n must be an integer." unless n.is_a? Integer
puts "n must be greater than 0." if n <= 0

Hope that solves your problem and update us. Thanks