#Dim declaring an initial value

objectscriptQuality release 
1.0.0
Id 
OS0046
Rule type 
Code Smell
Severity 

Minor

Minor
SQALE characteristic 
  • Reliability
    • Instruction
Tags 
maintainability
Remediation function 
Constant/issue
Remediation cost 
5min

The #Dim preprocessor directive allows to write, for instance:

    #dim x as %Integer = 2

However, this has a hidden consequence of generating an additional statement in the code, even though this is a preprocessor directive. The above is in fact equivalent to:

    #dim x as %Integer
    set x = 2