7. Nice work, the return


#1

Here the following lines have no return expression
"n must be an integer" unless n.is_a? Integer
"n must be greater than 0" if n <= 0

But why?
When I pass a string
first_n_primes("dsa")
the result is "comparison of String with 0 failed"
not "n must be an integer"


#2

If you mean that your function should return or print when the input is invalid, then you would need to write code that does that. (print/return)


7. Nice Work -> is it missing a couple of return statements?
#3

agree with dataSolver31535, there is something wrong with the code provided. the error returned when we provide invalid input is the one from the prime function. Therefore in the current solution provided, we evaluate a string expression at the beginning of the method and never use it.
The code should either print or return it.


#4

I agree. The "return" should be included before the text otherwise the code keeps processing. Return is used to exit a method at that point and while it can be omitted at the end of a method, it is required in the middle if you want to stop execution and return an error.