Constant declarations
To declare a constant, add the keyword CONSTANT to
a standard variable declaration:
1 |
CONSTANT { <span>access</span> } <span>datatype</span> <span>constname</span> = <span>value</span> |
Only a datatype that accepts an assignment in its declaration
can be a constant. For this reason, blobs cannot be constants.
Even though identifiers in PowerScript are not case sensitive,
the declarations shown here use uppercase as a convention for constant
names:
1 |
CONSTANT integer GI_CENTURY_YEARS = 100<br>CONSTANT string IS_ASCENDING = "a" |
Advantages of constants
If you try to assign a value to the constant anywhere other
than in the declaration, you get a compiler error. A constant is
a way of assuring that the declaration is used the way you intend.
Constants are also efficient. Because the value is established
during compilation, the compiled code uses the value itself, rather
than referring to a variable that holds the value.
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments
Oldest