- Nice Work https://www.codecademy.com/en/courses/ruby-beginner-en-Zjd2y/0/7
I'm getting "comparison of String with 0 failed" instead of the expected statement that "n must be an integer"
Here's the code I'm working with - notice the last line where I replaced
require 'prime' def first_n_primes(n) # Check for correct input! "n must be an integer" unless n.is_a? Integer "n must be greater than 0" if n <= 0 # The Ruby 1.9 Prime class makes the array automatically! prime = Prime.instance prime.first n end first_n_primes("a")
I think the first two statements after the def should have a return like this:
"n must be an integer" unless n.is_a? Integer "n must be greater than 0" if n <= 0
however it seems that the code as it is was supposed to show us the "streamlined" version of the code? But it's not really working though. Maybe I'm missing something?