Constants and Enumerations
Constants are a way of giving meaningful names to values that never change. They can make code more readable and maintainable by replacing literal numbers and strings that tend to get scattered throughout the code and become meaningless. A Constant cannot be modified after its value is set, giving code that uses them instead of variables greater safety, especially if the program is written by multiple developers. ViviFire predefines various constants that should be used to make code portable across platforms.
You can create your own constants using the Const statement. Such constants have the same scope as variables declared in the same code block. That means if a constant is declared inside a procedure, it is visible only within that particular procedure. A Const statement placed at the topmost level of a module makes the constant visible to the entire module, but not to any other modules.
Enumerations are convenient for working with sets of related constants. An often-used example is to assign numbers to the days of the week, then use the constants in place of the numbers in your code.
You can create your own enumerations using the Enum statement. Enum statements can be placed at module level or inside Class or Object blocks.
Enumerations are globally visible throughout an application. However, constants defined by an enumeration may not be unique and thus might require qualification.
The Enum statement can give an enumeration a type name, or it can be typeless. Enumeration types can be used after the As keyword in variable and parameter declarations. Such variables can be assigned the value of an enumeration member without qualification. Such variables can still be assigned any value in the underlying integer type's range, but this is considered a bad practice.