There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
Agree with a comment or answer? Like () to up-vote the contribution!
It says to remove one of the return statements. But you can’t remove the return from the Unless or the If statement. The way to pass the lesson is to remove the very last line: first_n_primes(10)
Isn’t this calling the method? It doesn’t seem to be a return statement. It helps to refactor the code, but I don’t understand why the lesson calls it a return statement.
EDIT: Nevermind, I made a mistake. I actually changed this line first: return Prime.first n
This is what the lesson is about. I deleted the method call & it was unrelated. My bad!
it says to remove the unnecessary return keywords, but both of them are necessary so just don’t change anything.
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.first n
end
first_n_primes(10)