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

Angel Castillo
Angel Castillo
1,605 Points

return methods:part 2

im kinda confused as to what its asking

method.rb
def mod(a, b)
  #write your code here
end

1 Answer

Juan Pablo Pinto Santana
Juan Pablo Pinto Santana
15,719 Points

Hello,

The challenge is asking you to return the remainder inside the sentence β€œThe remainder of a divided by b is c.”

You know that Ruby functions/methods always return the value of the last statement or line of the function's/method's body. So to complete the challenge, you must return a string with the appropiate components using string interpolation ( remember #{} ) in order to substitute 'c' with the actual value of the remainder. For example, this function returns a string:

def my_function
 "Inside this function"
end

Also the explicit way to do this:

def my_function
 return "Inside this function"
end

Cheers!