Methods blocks and sorting exercise 8


This is the link:

This is my code:

def greeter(name)
    return "Welcome" + " " + name
puts greeter("Emily")

def by_three?(number)
    if number % 3 == 0 
        return true
        return false

puts by_three?(30)

This is my result:
Welcome Emily

This is the error I am getting:
Oops, try again. It looks like your greeter method prints to the console instead of using return.

I don't know what it means? Can someone explain this to me. Thank you in advance.


In the instructions, they say "don't use print or puts". Your error message is letting you know that the code checker has detected that you have used one or the other of those.


ok. i understood that. but what would i put there instead. if I delete the entire line
puts greeter("Emily")
I would still get the same error!


If it still gives that same error then it might be picking up on the puts by_three?(30) line.


ok so what i did instead I used
output = greeter("Emily")

I did not get anything in the console! for this method.

though my second method worked after I changed to output = by_three?(30)
console printed:


For this exercise, it looks like they really don't want to see any output. Just use:



I see. Okay. thanks.

sometimes they want you to do less. Or not do something they thought you to do in an earlier expercise. why more practice is better for a newbie.


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