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!

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 Arguments

Joseph Silva
Joseph Silva
2,140 Points

Define a method named say. say should take one parameter (name the parameter whatever you want). In the say method body,

Please explain how I am incorrect.

def say(ruby)
  puts ("ruby")

2 Answers

Jason Anders
Jason Anders
Treehouse Moderator 145,855 Points

Hi Joseph,

There are a couple of things.

First, the instructions say to pass the argument from the function to the puts() method, but you are passing a string literal "ruby" instead of the parameter ruby. Once you surround something in quotation marks, it becomes a string.

Second, the instruction say to call the function with "Ruby" as an argument, but you are calling the function with "hi" as an argument.

Once you fix those up, the task will pass.

Also, it is not really a good idea to use the name of the language as a parameter name. It could get confusing and many times keywords will break the code. Try using something simple like a or name or param1 etc. Just a small tip.

Remember that challenges are very specific and the instructions need to be followed exactly, or the task will result in the Bummer!. Punctuation, capitalization, names, etc all are very important details.

Other than that, nice work! :) :dizzy:

Brandon Williams
Brandon Williams
6,679 Points

I can't get this to work either. This is what I wrote:

def say(Chuck_Norris)
  puts "Ruby"