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

Lia Lee
PLUS
Lia Lee
Courses Plus Student 1,030 Points

How do i use string interpolation to place the "return" inside a sentence that under a new variable "c"?

I am stuck on this quiz question. Not sure what the proper syntax would be.

Lia Lee
Lia Lee
Courses Plus Student 1,030 Points

I meant to say "place the "return" value inside of a sentence, and under a new variable "c"?" Not "that".

7 Answers

Full answer should look like this:

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

Define "c" then your return statement.

  c = a%b
  return "The remainder of #{a} divided by #{b} is #{c}."
Lia Lee
PLUS
Lia Lee
Courses Plus Student 1,030 Points

I tried that. Let me refresh the browser and try again.

Lia Lee
PLUS
Lia Lee
Courses Plus Student 1,030 Points

I get this error:

Bummer! Something doesn't look quite right. Double check your spelling and punctuation.

Lia Lee
PLUS
Lia Lee
Courses Plus Student 1,030 Points

Now says: Bummer! The 'mod' method should take 2 arguments

ahhhh! This is frustrating...do you think there is a bug in the module?

Lia, My bad! I forgot to add the (a,b) to the def mod line. Try it now!

Lia Lee
PLUS
Lia Lee
Courses Plus Student 1,030 Points

Thank you so much!! That worked, I will study the syntax to see what I was missing. Thank you again!