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")

1 Answer

Jason Anders
Jason Anders
Treehouse Moderator 143,733 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: