Ruby Ruby Basics Ruby Syntax Method Arguments

Ian Dunn
Ian Dunn
967 Points

def say(text) puts text+"Ruby" end say("Hello...") Not sure what I am doing wrong? It works in the console?

It's saying I need a parameter? isnt that what text is fulfilling?

say.rb
def say(text)
  puts text+"Ruby"
end

say("Hello...")

3 Answers

Clayton Perszyk
MOD
Clayton Perszyk
Treehouse Moderator 45,769 Points

Hey Ian,

You just puts text in the method:

def say(text)
  puts text
end

say("Ruby")
Ian Dunn
Ian Dunn
967 Points

Just got it, before seeing this. Yay! Exciting. Thanks for helping me Clayton!

Clayton Perszyk
MOD
Clayton Perszyk
Treehouse Moderator 45,769 Points

you only need to puts text, and pass in "Ruby" as the argument

Ian Dunn
Ian Dunn
967 Points

Sorry still trying to wrap my head around it... so perhaps something like this ...

def say(text) text = "hello, Ruby" end

print say