Glitch or bad code for "Greeter" method?


#1

Hi folks, think I might be getting a glitch and can't seem to figure out how to clear it up. I'm working on the greeter method exercise. I'm getting the error message:

"It looks like your greeter method prints to the console instead of using return."

But my code includes return and not print or puts. Any ideas? Thanks!!

Link to exercise:
https://www.codecademy.com/courses/ruby-beginner-en-ET4bU/1/4?curriculum_id=5059f8619189a5000201fbcb

print "What's your name?"
name = gets.chomp

def greeter(name)
    return "Hi #{name}"
end

def by_three?(n)
    if n % 3 == 0
        return true
    else
        return false
    end
end

#2

Wow okay just used "puts" and it worked. Very misleading error message!!


#3

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