I need a method in Ruby which takes in 2 arguments, the number of donuts and a maximum donut intake. This method should return good job if he eats less than half his maximum intake and to get back on his diet when he exceeds his maximum it.
I understand what the method needs to do but am having trouble with the syntax. I tried the following but cannot pass the rspec:
def some_donuts(donuts, maximum)
if donuts < maximum
"Get back on your diet!"
else donuts > (maximum / 2)
"Good job!"
end
end
Can anyone help with some hints in the right direction?
Aucun commentaire:
Enregistrer un commentaire