Of course, any node can have its value changed at any time. Note that not all the nodes in the tree have assigned values. Two in particular, A(3)
, only have children. They were created only because Set
statements created their children. They can remain valueless, or you can give them values later on. This demonstrates another unique feature of ObjectScript arrays: locations can exist without having assigned values. In other languages, if a variable exists, it always has a value.
There is a very important function that allows you to probe the nodes of a tree and learn about their status: $Data. If $Data
returns a non-zero result, the node exists in some way.
SAMPLES>write $data(A) ; has value and descendants
SAMPLES>write $data( A(3) ) ; has descendants only
SAMPLES>write $data( A(3, 3) ) ; has value only
SAMPLES>write $data( A(3, 5) ) ; doesn't exist
© 1997-2019 InterSystems Corporation, Cambridge, MA