Kbase P182516: Can I define a constant variable?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  15/02/2011 |
|
Status: Unverified
GOAL:
Can I define a constant variable?
GOAL:
Are constants supported by ABL?
FACT(s) (Environment):
All Supported Operating Systems
Progress/OpenEdge Product Family
FIX:
No. Constants are not a feature available on ABL.
Use pre-processors &GLOBAL-DEFINE or &SCOPED-DEFINE instead.
Another alternative is to use read-only static class properties.
This has the added benefit that OE Architect knows about it in terms of syntax completion etc.
e.g:
Class MyConstants:
Def static public property Pi as decimal no-undo get. private set.
Constructor static MyConstants():
MyConstants:Pi = 22 / 7.
End.
End class.
then use:
dArea = MyConstants:Pi * exp(dRadius, 2).