Null object: Difference between revisions

Updated D entry
(Scala.)
(Updated D entry)
Line 209:
 
=={{header|D}}==
In D ''is'' is used forto comparingperform bitwise identity, like twoto objects orcompare an object reference against null.
{{libheader|tango}}
<lang d>import tangostd.io.Stdoutstdio;
In D ''is'' is used for comparing identity, like two objects or an object against null.
<lang d>import tango.io.Stdout;
 
class K {}
if(object is null)
 
{
void main() {
Stdout.formatln("object is null");
K k;
if (objectk is null)
Stdout.formatln writeln("objectk is null");
k = new K;
if (k !is null)
writeln("Now k is not null");
}</lang>
{{out}}
<pre>k is null
Now k is not null</pre>
 
=={{header|Delphi}}==