say.rb - I don't know what I'm doing wrong
Instructions: Define a method named say. say should take one parameter (name the parameter whatever you want). In the say method body, take the parameter and pass it to puts as an argument. End your program with a call to the say method, and pass the string "Ruby" as an argument.
I've tried so many variations and Google'ing I can't figure out how to fix this error:
Bummer! Your "say" method should take exactly 1 parameter.
Jennifer NordellTreehouse Staff
Hi there! The challenge asks you to define a function that takes one parameter. Currently, your function takes no parameters. Then the function should use
puts to put whatever you send in to the screen. However, your code will always print out "Ruby". We want this to be more flexible. We want to print out whatever was sent in.
def say(greeting) puts greeting end say("Hi there, Ari!")
In the example above I declared a function named "say" that has one parameter. When I call this function a piece of information will be passed in. I'm sending in the string "Hi there, Ari!". This will be assigned to a local variable named
greeting. I then print the value of
greeting to the screen.
I think you can get it with these hints, but let me know if you're still stuck!
def say name puts "Ruby" end say ("Ruby")
this is what I'm working on. I have tried everything I know how to do and still nothing. Ive even watched the videos twice and it seems as if Im doing things right but still get errors
Moderator edited: added markdown to the post so that code renders properly in the forums.
it did - Thank you - Thank you very much!!!