| Start |
|---|
Define a constant Constant name start with capital letter. Everything that start with capital letter are considered as |
Modify a Constant The above code results in a warning, because you should be using variables if you want to change their values. However it is possible to change one letter at a time in a constant without a warning, like this: Now, after changing the second letter of |
Constants cannot be defined in methods The above code results in an error: |
Define and change constants in a class The constant Syntax
RemarksConstants are useful in Ruby when you have values that you do not want to be mistakenly changed in a program, such as API keys. |
Read Article
https://develop.horje.com/learn/1434/reference