7. Nice work, the return


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
the result is "comparison of String with 0 failed"
not "n must be an integer"


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?

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.


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.