Define a constant
suggest changeMY_CONSTANT = "Hello, world" # constant
Constant = 'This is also constant' # constant
my_variable = "Hello, venus" # not a constant
A constant name starts with a capital letter. Anything that starts with a capital letter is a constant in Ruby, so class and module names are constants too. The usual style is SCREAMING_SNAKE_CASE. Assigning to an existing constant prints a warning; it does not raise by default.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents