# Practice Makes Perfect (or does it)

#1

"It looks like your by_three? method doesn't return false for all numbers not evenly divisible by three."

What am I doing wrong here? It looks like I'm telling it to do the right thing? When I change the argument, it's coming up with true or false correctly, but I'm still getting an error message. Help please!

``````def greeter(name)
return "Hello, #{name}"
end

def by_three?(number)
if number % 3 == 0
return "TRUE!"
else
return "FALSE"
end
end

by_three?(14)
by_three?(27)``````

#2

Right, so I've fixed it by stripping it back to the below:

def greeter(name)
return "Hello, #{name}"
end

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

by_three?(5)

But I have no idea why the first one doesn't work. Please could someone explain? Thanks!

#3

because you was returning `string` expression instead of `boolean` expression

#4

What is the difference between those two things? And could you point out where in the code I am doing that? I'm a newbie and am just getting to grips with these concepts, so would appreciate if you assumed I knew nothing

#5

Hi, the code that you should have to make this work just needs to return "true". Just change

to

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

by_three?(6)

That should work.

#6

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