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 Ruby Syntax Method Return Values

Whats wrong

I ran the code in my own linux box. It worked.

methods.rb
def three(a)
  a=3
  return a
end

def five(b)
  b=5
  return b 
end

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hi Sherman,

You have a couple of issues here.

First, the instructions need to be followed exactly as they are stated. Here the instructions does not say anything about a parameter for the method, so the parenthesis should be empty ==> def method_name() Note: you could eliminate the parenthesis all together, but I like them there, so the "no parameters" is clear to anyone reading the code.

Second, the instructions do not say to assign a value to any variable, so the method should just return the hard-coded value it asks for. This can be done with the return method, or in Ruby, the last line of a method will automatically be returned, so you don't even need the return for this method.

The correct method would look like this:

def three()   # No parameters are asked for, so the () should be empty
  3           # This is the last line of the method, so the value will be an implicit return
end

Keep Coding! :) :dizzy: