8 Greeting not being output to the console


#1



Stuck on 8 - Method, Blocks, and Sorting


My code passes, but doesn't print the greeting or name to the console.


def greeter(name)
    return "welcome to ruby #{ name}!" 
end

greeter("dom")

def by_three?(n)
    return n % 3 == 0
end

output = by_three?(9)

Is it supposed to print from this exercise? I can make it print using another command, but then my code doesn't pass anymore (Ie if I use puts greeter(dom)


#2

@dominicteacher,

def greeter(name)
    return "welcome to ruby #{name}!" 
end

print greeter("dom")+"\n"

def by_three?(n)
    return n % 3 == 0
end

output = by_three?(9)
print output

#3

Thanks for your answer.

The courses so far haven't mentioned "\n" . I wish it had been something I could figure out on my own.

Thanks again


#4

@dominicteacher,
Have a look at
http://stackoverflow.com/questions/19743964/where-can-i-find-string-escape-sequences-in-the-ruby-documentation


#5

This actually doesn't pass the test for me. It tells me I am printing and should be able use "return" to get the greeting to appear in the console.

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


#6

@dominicteacher
Then remove the print statement
and just call the program...

You must however use EXACT text's or =return Value's= as are asked for
in the Instructions.....