You can define method or script-level constants. Once defined, constants cannot be changed, and they should be used to define some constant values for specific method (say, a role identifier or price for action) or script.
Constants can be defined as primitive types (integers, bool and address) and as a
vector. They are accessed by their names and are local to script/method where they are defined.
Accessing constant value from outside of its method is impossible
Same usage in method:
What is important to know about constants:
- They are unchangeable once defined;
- They are local to their method or script and cannot be used outside;
- Usually they are used to define method-level constant value which serves some business purpose;
- It is also possible to define constant as an expression (with curly braces) but syntax of this expression is very limited.