Today, I started to try to learn ruby. When I went to make my first
method, I kept receiving an error “undefined local variable or method.”
I tried looking up how to make methods in Ruby online, so that I would
be sure its not my own fault. I copy pasted several examples into my
ide, all of which returned the same error.
I made a simple method (below) and I get the same error: class:TEST’:
undefined local variable or method `greeter’ for TEST:Class (NameError)
class TEST
def greeter()
puts ‘Hi’
end
greeter
end
The built in ruby methods work fine. Is there something wrong with what
I’m doing?