Ruby Ruby Basics Ruby Syntax Method Return Values

Derek Hutson
Derek Hutson
9,740 Points

Weird question.. what am I doing wrong?

Hi all, I keep getting a syntax error and not sure why.. Thanks for help!

methods.rb
def three(3)
end

def five(5)
end

1 Answer

Matt Hanson
MOD
Matt Hanson
Treehouse Moderator 17,685 Points

Hey Derek. In this challenge you're being asked to return 5 and 3 respectively in your two functions. Right now you're passing in 5 and 3 as parameters to your functions. Instead of passing in the numbers as parameters, use the return keyword inside the body of your functions. Syntax example:

def ruby_func()
  return value
end

I hope this clears things up!

Derek Hutson
Derek Hutson
9,740 Points

Got it.. asking for no argument threw me off so I didn't put anything in the body!