Omit Needless Words


#1

My code passes, but I don’t understand why it won’t return either string in the codeacademy display. No matter what I pass in as an argument at the end.

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
  

  return Prime.first n
end

first_n_primes(10)

#2

There are no statements directing output.

puts first_n_primes(10)

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.