Constants cannot be defined in methods

suggest change
def say_hi
  MESSAGE = "Hello"
  puts MESSAGE
end

The above code results in an error: SyntaxError: dynamic constant assignment. This is the = form inside a method. Module#const_set can still create a constant at runtime.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents