8/19 print to console


#1

def greeter(name)
return ("greeting"+name)
end
def by_three?(number)
(number%3)?(return true): (return false)
end
l=greeter("abc")
f=by_three?(30)
puts l
puts f

says
It looks like your greeter method prints to the console instead of using return.
help pls
edited:
solved


#2

sorry got it
just removed the puts command
idk y it was not working


#3

def greeter(name)
return ("greeting"+name)
end
def by_three?(number)
(number %3 ==0)?(return true): (return false)
end
greeter("abc")
by_three?(30)

the answer


#4

@eliyafariha

Thanks for sharing. Where did you learn the format of

(argument % 3 == 0)? (return true): (return false)?

Is that shorthand? I had longer code at first, and then the following worked:

def by_three?(number)
#Is this a fancy shortcut to return true and false? Because before I had (read comment below line 11...)
return true if number % 3 == 0
return false if number % 3 != 0
end

The originally longer code was giving me correct answers but the system was saying it was wrong