Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby Ruby Basics Ruby Syntax Method Arguments

Isaiah Narraway
Isaiah Narraway
8,296 Points

My say method is invalid?

When i attempt to pass my parameters as an argument, it says 'Your "say" method should take exactly 1 parameter.'

say.rb
def say(first)
  first
end
say

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Isaiah Narraway! There are a couple of things going on here. In the body of the method, it should be using puts to display whatever was sent in. To call a method, you need a pair of parentheses that will then pass in any arguments needed. In this case, the argument is meant to be the string "Ruby" per the instructions. You're pretty close here, though.

def say(first)
  puts first  # print whatever was sent in
end

say("Ruby") # call the method and send it the string "Ruby"

Hope this helps! :sparkles: