Constant in X++ Programming Language
Table of Content:
Follow the best practices rules about using constants. These are designed to make it easier to maintain X++ code.
Rule |
Error level |
---|---|
Do not use hard-coded constants (except 0, 1, 100). |
Warning |
Define constants in a method, class declaration, or if necessary globally in a macro. Reuse existing constants. Consider alternative ways of getting the constant:
|
None |
Numeric Constants
Rule |
Error level |
---|---|
Always review the direct use of numeric constants, except for 0 meaning null, 1 meaning increment, and 100 when calculating percents and currencies. |
None |
Certain numeric constants are predefined, such as the number of days per week, and the number of hours per day. For example, see the TimeConstants and SysBitPos macros in the Application Object Tree (AOT). |
None |