Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Ruby Basics (Retired) Ruby Methods Method Returns: Part 2

Craig Shukie
Craig Shukie
8,839 Points

What's wrong with my code?

I've just completed this code challenge however it says that my work is wrong?

I've copied my code into a work space and running it there works fine?

Can someone please help?

method.rb
def mod(a, b)
  c = a % b
  return puts "The remainder of #{a} divided by #{b} is: #{c}"
end

1 Answer

jason chan
jason chan
31,009 Points
def mod(a, b)
  c = a % b
  "The remainder of #{a} divided by #{b} is #{c}."
end

you don't need return or puts.

Craig Shukie
Craig Shukie
8,839 Points

Hi Jason, thanks for the quick response!

Ive copied your code but it still says its incorrect? I get the error "Double check your spelling and punctuation"

aNy other ideas?

Craig Shukie
Craig Shukie
8,839 Points

Ignore me id spelt remainder incorrectly! thanks again!