docs.intersystems.com
ObjectScript Tutorial
Ordered Trees, continued
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Search:    

As you've seen, you can use both positive and negative integers and real numbers, and non-numeric strings, as array subscripts. In a little while, you'll learn how to use this capability to your advantage. By the way, the only prohibited subscript is the empty string.
Now for some terms. The entire structure is called a tree. Like a family tree and unlike a real tree, it begins at the top and grows downwards. The root A is at the top. The root, and any other subscripted form of A, are called nodes. Nodes that have no nodes beneath them are called leaves. Nodes that have nodes beneath them are called parents or ancestors. Nodes that have parents are called children or descendants. Children with the same parents are called siblings. All siblings are automatically sorted numerically or alphabetically as they are added to the tree.
This tree structure allows you to create multidimensional arrays of any depth, in order to easily model hierarchies from the real world. Try drawing a picture of a six dimensional array in another way and you'll understand the benefits of this structure!


Send us comments on this page
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA