Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Ruby Basics Ruby Syntax Defining Methods

Elizabeth Naves
Elizabeth Naves
39,088 Points

What am I doing wrong here?

I have rewatched the videos several times. Every time I go to do this code challenge, I receive " Bummer! undefined local variable or method `say_hi' for main: Object"

hello.rb
def say(say_hi)
  puts hi
end

say (say_hi)

1 Answer

Tabatha Trahan
Tabatha Trahan
21,422 Points

It looks like it wants you to define a method called say_hi that puts "Hi" to the screen, and then to call that method. So the method name would be say_hi, and doesn't take any arguments. After the method definition, call the method. Try this out:

def say_hi
  puts "Hi"
end

say_hi