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

Trinitye Behrman
Trinitye Behrman
9,314 Points

Error "Make sure you return a nicely formatted string." No matter how I format the string on Return methods: Part 2

I've tried to format this is many ways. However I keep getting the same error, and I can't move forward. I've checked the videos multiple times and can't see what I missed.

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

mod(10, 6)

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! I don't think it's possible to be closer to the answer without actually getting it correct. :thumbsup:

Take a look at this quote from the instructions:

Use string interpolation to return the remainder inside the sentence “The remainder of a divided by b is c.” where a is your “a” variable, b is your “b” variable, and c is the value of a % b.

Note the word "return". You are printing the string... not returning it. So for the challenge to pass, you simply need to change puts to return.

Challenges are very strict and require that you follow the instructions to the letter. Hang in there and keep coding! :sparkles: