Undefined values: Difference between revisions

(→‎{{header|C}}: Show an uninitialized variable (as the D example already does). Move some text to Null object#C, and leave a link.)
Line 652:
: MyVar
-> 7</lang>
=={{header|Pike}}==
In Pike variables are always defined. <code>UNDEFINED</code> is only used to indicate the nonexistence of a key or object member. <code>UNDEFINED</code> is not a value and can not be assigned. in such cases it is converted to <math>0</math>. <code>zero_type()</code> is used to test if a key exists or not:
<lang Pike>
> zero_type(UNDEFINED);
Result: 1
> mapping bar = ([ "foo":"hello" ]);
> zero_type(bar->foo);
Result: 0
> zero_type(bar->baz);
Result: 1
> bar->baz=UNDEFINED;
Result: 0
> zero_type(bar->baz);
Result: 0
</lang>
 
=={{header|Prolog}}==
Anonymous user