Ruby Ruby Basics Ruby Syntax Method Arguments

Pui Lun Christin C Hebron
Pui Lun Christin C Hebron
5,693 Points

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

This is my answer, not sure why it's not working

Define a method named say. The say method 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.

def say(ruby) puts(ruby) end

say(hi)

say.rb
def say(ruby)
  puts(ruby)
end

say(hi)

1 Answer

Steven Parker
Steven Parker
182,024 Points

The error message gives you a clue: "Bummer: undefined local variable or method `hi' for main:Object". Since "hi" is not enclosed in quotes, it is taken to be an identifier but nothing by that name has been defined.

But the instructions say to "pass the string "Ruby" as an argument.", so that's what should be there anyway.