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

I cant seem to get past this part of the tutorial, I did what it asked and my code returns a 'Nice clean string'!

I am trying to go through this tutorial, and I got to a place where it wants me to create a method with 2 arguments that return a good, clean string with "The remainder in the division of a and b is c", and I made a nice string but it wont accept it, I dont know what it wants, the thing looks good to me!

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

2 Answers

Try using return instead of puts.

def mod(a, b)
  c = a % b
    return "The remainder of #{a} divided by #{b} is #{c}"
end
mod(17,4)
Taylor Porter
Taylor Porter
2,338 Points

Hi Michael!

Make sure you add your punctuation! The lesson is very specific on your grammar.

You put:

def mod(a, b) c = a % b puts "The remainder of #{a} divided by #{b} is #{c}" end mod(17,4)

You should have put:

def mod(a, b) c = a % b return "The remainder of #{a} divided by #{b} is #{c}." end mod(17,4)

Hope this helps!