Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.Opens in a new tab

For information on migrating to InterSystems IRISOpens in a new tab, see Why Migrate to InterSystems IRIS?

変数値とノードの存在、および $Data 関数

generated description: treedone.gif

ノードの値はいつでも変更できます。しかし、値が割り当てられていないノードもあります。A(3)A(5,"D") の 2 つには子があります。Set 文で下位に子を生成しているため、A(3)A(5,"D") には値を割り当てないか、あるいは後で割り当てます。また、ObjectScript 配列には別の機能も備わっています。つまり、メモリ位置は値を割り当てられていなくても存在します。他の言語では、変数が存在する場合は常に値が設定されています。

$Data 関数は、ツリーのノードを検査しステータスを調べる重要な関数です。$Data がゼロ以外の結果を返した場合、ノードが存在していることを示します。

SAMPLES>write $data(A) ; has value and descendants
11
SAMPLES>write $data( A(3) ) ; has descendants only
10
SAMPLES>write $data( A(3, 3) ) ; has value only
1
SAMPLES>write $data( A(3, 5) ) ; doesn't exist
0
FeedbackOpens in a new tab