Article
· 4 hr ago 1m read

#DIM vs SET - Objectscript

SET assigns value to the variable at RUNTIME.

#DIM declare the variable and it's Data Type at COMPILE TIME.


SET #DIM
Makes the variables Dynamic. Improves Readability.
No Data Type Declaration. Enables IDE auto-completion.
Runtime Useful for Object references.

#DIM name As %String
Set name = "Micheal Scott"
#DIM age As %Numeric
Set age = 36
#DIM employer As App.Employer               ; compile time
Set employer = ##class(App.Employer).%New() ; runtime 

 

SET or #DIM? Your design, your rules.

Discussion (1)2
Log in or sign up to continue